diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_map.py | 11 | ||||
-rw-r--r-- | tests/test_none_keys.py | 8 |
2 files changed, 8 insertions, 11 deletions
diff --git a/tests/test_map.py b/tests/test_map.py index b6ee7f1..4a473b3 100644 --- a/tests/test_map.py +++ b/tests/test_map.py @@ -845,11 +845,10 @@ class BaseMapTest: def test_repr_1(self): h = self.Map() - self.assertTrue(repr(h).startswith('<immutables.Map({}) at 0x')) + self.assertEqual(repr(h), 'immutables.Map({})') h = h.set(1, 2).set(2, 3).set(3, 4) - self.assertTrue(repr(h).startswith( - '<immutables.Map({1: 2, 2: 3, 3: 4}) at 0x')) + self.assertEqual(repr(h), 'immutables.Map({1: 2, 2: 3, 3: 4})') def test_repr_2(self): h = self.Map() @@ -879,8 +878,7 @@ class BaseMapTest: h = h.set(k, 1) k.val = h - self.assertTrue(repr(h).startswith( - '<immutables.Map({{...}: 1}) at 0x')) + self.assertEqual(repr(h), 'immutables.Map({{...}: 1})') def test_hash_1(self): h = self.Map() @@ -964,8 +962,7 @@ class BaseMapTest: h = h.set('a', 1) hm1 = h.mutate() - self.assertTrue(repr(hm1).startswith( - "<immutables.MapMutation({'a': 1})")) + self.assertEqual(repr(hm1), "immutables.MapMutation({'a': 1})") with self.assertRaisesRegex(TypeError, 'unhashable type'): hash(hm1) diff --git a/tests/test_none_keys.py b/tests/test_none_keys.py index f7969f3..92e7813 100644 --- a/tests/test_none_keys.py +++ b/tests/test_none_keys.py @@ -61,7 +61,7 @@ class BaseNoneTest: self.assertEqual(len(m), 1) self.assertTrue(None in m) self.assertEqual(m[None], 1) - self.assertTrue(repr(m).startswith('<immutables.Map({None: 1}) at 0x')) + self.assertEqual(repr(m), 'immutables.Map({None: 1})') for level in range(7): key = NoneCollision('a', level) @@ -72,7 +72,7 @@ class BaseNoneTest: m = m.delete(None) self.assertEqual(len(m), 0) self.assertFalse(None in m) - self.assertTrue(repr(m).startswith('<immutables.Map({}) at 0x')) + self.assertEqual(repr(m), 'immutables.Map({})') self.assertEqual(m, self.Map()) @@ -125,7 +125,7 @@ class BaseNoneTest: self.assertFalse(None in m3) self.assertFalse(key in m3) self.assertEqual(m3, self.Map()) - self.assertTrue(repr(m3).startswith('<immutables.Map({}) at 0x')) + self.assertEqual(repr(m3), 'immutables.Map({})') with self.assertRaises(KeyError): m3.delete(None) with self.assertRaises(KeyError): @@ -144,7 +144,7 @@ class BaseNoneTest: self.assertFalse(None in m4) self.assertFalse(key in m4) self.assertEqual(m4, self.Map()) - self.assertTrue(repr(m4).startswith('<immutables.Map({}) at 0x')) + self.assertEqual(repr(m4), 'immutables.Map({})') with self.assertRaises(KeyError): m4.delete(None) with self.assertRaises(KeyError): |