diff --git a/implementations/python/test_preserves.py b/implementations/python/test_preserves.py index fabb73c..654ec08 100644 --- a/implementations/python/test_preserves.py +++ b/implementations/python/test_preserves.py @@ -169,3 +169,16 @@ class CodecTests(unittest.TestCase): 0xE2, 0x7A, "first-name", 0x59, "Elizabeth", 0xE2, 0x77, "surname", 0x59, "Blackwell"), nondeterministic = True) + + def test_iterator_stream(self): + d = {u'a': 1, u'b': 2, u'c': 3} + r = r'2c(c2516.1.){3}3c' + if hasattr(d, 'iteritems'): + # python 2 + bs = _e(d.iteritems()) + self.assertRegexpMatches(_hex(bs), r) + else: + # python 3 + bs = _e(d.items()) + self.assertRegex(_hex(bs), r) + self.assertEqual(sorted(_d(bs)), [(u'a', 1), (u'b', 2), (u'c', 3)])