Fix: MutableRecord.__ne__ misspelt as '__neq__'.

Add tests for MutableRecord and Position.
This commit is contained in:
joo 2018-06-21 07:06:45 +01:00
parent 4b6feda1cb
commit bea2222c58
3 changed files with 6 additions and 2 deletions

View File

@ -67,7 +67,7 @@ class MutableRecord(object):
return type(self) is type(other) and \ return type(self) is type(other) and \
all(getattr(self, a) == getattr(other, a) for a in self.__slots__) all(getattr(self, a) == getattr(other, a) for a in self.__slots__)
def __neq__(self, other): def __ne__(self, other):
return not (self == other) return not (self == other)
def __hash__(self): def __hash__(self):

View File

@ -28,7 +28,7 @@ TEST_DATA = {
TrailingByteArray: [b'Q^jO<5*|+o LGc('], TrailingByteArray: [b'Q^jO<5*|+o LGc('],
UUID: ["12345678-1234-5678-1234-567812345678"], UUID: ["12345678-1234-5678-1234-567812345678"],
StringType: ["hello world"], StringType: ["hello world"],
Position: [(758, 0, 691)], Position: [(758, 0, 691), (-500, -12, -684)],
} }

View File

@ -69,3 +69,7 @@ class PositionAndLookTest(unittest.TestCase):
self.assertEqual(pos_look_1.look, pos_look_2.look) self.assertEqual(pos_look_1.look, pos_look_2.look)
self.assertEqual(hash(pos_look_1), hash(pos_look_2)) self.assertEqual(hash(pos_look_1), hash(pos_look_2))
self.assertEqual(str(pos_look_1), string_repr) 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)