From bea2222c5846a409f31d21c82ac51fb8c19dcaee Mon Sep 17 00:00:00 2001 From: joo Date: Thu, 21 Jun 2018 07:06:45 +0100 Subject: [PATCH] Fix: MutableRecord.__ne__ misspelt as '__neq__'. Add tests for MutableRecord and Position. --- minecraft/networking/types/utility.py | 2 +- tests/test_serialization.py | 2 +- tests/test_utility_types.py | 4 ++++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/minecraft/networking/types/utility.py b/minecraft/networking/types/utility.py index de6cf59..aa58bf3 100644 --- a/minecraft/networking/types/utility.py +++ b/minecraft/networking/types/utility.py @@ -67,7 +67,7 @@ class MutableRecord(object): return type(self) is type(other) and \ all(getattr(self, a) == getattr(other, a) for a in self.__slots__) - def __neq__(self, other): + def __ne__(self, other): return not (self == other) def __hash__(self): diff --git a/tests/test_serialization.py b/tests/test_serialization.py index 941922b..6fcd6e7 100644 --- a/tests/test_serialization.py +++ b/tests/test_serialization.py @@ -28,7 +28,7 @@ TEST_DATA = { TrailingByteArray: [b'Q^jO<5*|+o LGc('], UUID: ["12345678-1234-5678-1234-567812345678"], StringType: ["hello world"], - Position: [(758, 0, 691)], + Position: [(758, 0, 691), (-500, -12, -684)], } diff --git a/tests/test_utility_types.py b/tests/test_utility_types.py index 2d1d732..3f8cc35 100644 --- a/tests/test_utility_types.py +++ b/tests/test_utility_types.py @@ -69,3 +69,7 @@ class PositionAndLookTest(unittest.TestCase): self.assertEqual(pos_look_1.look, pos_look_2.look) self.assertEqual(hash(pos_look_1), hash(pos_look_2)) self.assertEqual(str(pos_look_1), string_repr) + + self.assertFalse(pos_look_1 != pos_look_2) + pos_look_1.position += Vector(1, 1, 1) + self.assertTrue(pos_look_1 != pos_look_2)