Skip to content

Commit

Permalink
tests: add another cyclical test
Browse files Browse the repository at this point in the history
Ensure that instances inside lists are properly referenced.

Signed-off-by: David Aguilar <davvid@gmail.com>
  • Loading branch information
davvid committed Apr 26, 2013
1 parent f886b2e commit 45c1bd2
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions tests/jsonpickle_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -598,6 +598,16 @@ def test_load_backend_skips_bad_decoder_exceptions(self):
jsonpickle.load_backend('os.path', 'join', 'split', 'bad!')
self.failIf(self._backend_is_partially_loaded('os.path'))

def test_list_item_reference(self):
thing = Thing('parent')
thing.child = Thing('child')
thing.child.refs = [thing]

encoded = jsonpickle.encode(thing)
decoded = jsonpickle.decode(encoded)

self.assertEqual(id(decoded.child.refs[0]), id(decoded))


# Test classes for ExternalHandlerTestCase
class Mixin(object):
Expand Down

0 comments on commit 45c1bd2

Please sign in to comment.