Skip to content

Commit

Permalink
fix py3x tests
Browse files Browse the repository at this point in the history
  • Loading branch information
agroszer committed Feb 23, 2017
1 parent 30c6cd9 commit 25b5269
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions persistent/tests/test_persistence.py
Original file line number Diff line number Diff line change
Expand Up @@ -985,14 +985,14 @@ class Derived(self._getTargetClass()):
key2 = list(inst2.__dict__.keys())[0]
self.assertTrue(key1 is key2)

import UserDict
from persistent._compat import IterableUserDict
inst1 = Derived()
inst2 = Derived()
key1 = 'key'
key2 = 'ke'; key2 += 'y' # construct in a way that won't intern the literal
self.assertFalse(key1 is key2)
state1 = UserDict.IterableUserDict({key1: 1})
state2 = UserDict.IterableUserDict({key2: 2})
state1 = IterableUserDict({key1: 1})
state2 = IterableUserDict({key2: 2})
k1 = list(state1.keys())[0]
k2 = list(state2.keys())[0]
self.assertFalse(k1 is k2) # verify
Expand All @@ -1002,7 +1002,6 @@ class Derived(self._getTargetClass()):
key2 = list(inst2.__dict__.keys())[0]
self.assertTrue(key1 is key2)


def test___setstate___doesnt_fail_on_non_string_keys(self):
class Derived(self._getTargetClass()):
pass
Expand All @@ -1021,8 +1020,8 @@ class Derived(self._getTargetClass()):
pass
inst1 = Derived()

import UserDict
state = UserDict.IterableUserDict({'foobar': [1, 2]})
from persistent._compat import IterableUserDict
state = IterableUserDict({'foobar': [1, 2]})

inst1.__setstate__(state)
self.assertTrue(hasattr(inst1, 'foobar'))
Expand Down

0 comments on commit 25b5269

Please sign in to comment.