Test for encodestream
This commit is contained in:
parent
9762ad4bfb
commit
eb090bea4b
|
@ -169,3 +169,16 @@ class CodecTests(unittest.TestCase):
|
||||||
0xE2, 0x7A, "first-name", 0x59, "Elizabeth",
|
0xE2, 0x7A, "first-name", 0x59, "Elizabeth",
|
||||||
0xE2, 0x77, "surname", 0x59, "Blackwell"),
|
0xE2, 0x77, "surname", 0x59, "Blackwell"),
|
||||||
nondeterministic = True)
|
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)])
|
||||||
|
|
Loading…
Reference in New Issue