Commit 25b52694 authored by Adam Groszer's avatar Adam Groszer

fix py3x tests

parent 30c6cd93
...@@ -985,14 +985,14 @@ class _Persistent_Base(object): ...@@ -985,14 +985,14 @@ class _Persistent_Base(object):
key2 = list(inst2.__dict__.keys())[0] key2 = list(inst2.__dict__.keys())[0]
self.assertTrue(key1 is key2) self.assertTrue(key1 is key2)
import UserDict from persistent._compat import IterableUserDict
inst1 = Derived() inst1 = Derived()
inst2 = Derived() inst2 = Derived()
key1 = 'key' key1 = 'key'
key2 = 'ke'; key2 += 'y' # construct in a way that won't intern the literal key2 = 'ke'; key2 += 'y' # construct in a way that won't intern the literal
self.assertFalse(key1 is key2) self.assertFalse(key1 is key2)
state1 = UserDict.IterableUserDict({key1: 1}) state1 = IterableUserDict({key1: 1})
state2 = UserDict.IterableUserDict({key2: 2}) state2 = IterableUserDict({key2: 2})
k1 = list(state1.keys())[0] k1 = list(state1.keys())[0]
k2 = list(state2.keys())[0] k2 = list(state2.keys())[0]
self.assertFalse(k1 is k2) # verify self.assertFalse(k1 is k2) # verify
...@@ -1002,7 +1002,6 @@ class _Persistent_Base(object): ...@@ -1002,7 +1002,6 @@ class _Persistent_Base(object):
key2 = list(inst2.__dict__.keys())[0] key2 = list(inst2.__dict__.keys())[0]
self.assertTrue(key1 is key2) self.assertTrue(key1 is key2)
def test___setstate___doesnt_fail_on_non_string_keys(self): def test___setstate___doesnt_fail_on_non_string_keys(self):
class Derived(self._getTargetClass()): class Derived(self._getTargetClass()):
pass pass
...@@ -1021,8 +1020,8 @@ class _Persistent_Base(object): ...@@ -1021,8 +1020,8 @@ class _Persistent_Base(object):
pass pass
inst1 = Derived() inst1 = Derived()
import UserDict from persistent._compat import IterableUserDict
state = UserDict.IterableUserDict({'foobar': [1, 2]}) state = IterableUserDict({'foobar': [1, 2]})
inst1.__setstate__(state) inst1.__setstate__(state)
self.assertTrue(hasattr(inst1, 'foobar')) self.assertTrue(hasattr(inst1, 'foobar'))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment