We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 8d32bef commit ecdbd45Copy full SHA for ecdbd45
test/test_canonical.py
@@ -0,0 +1,27 @@
1
+
2
+from nose.tools import *
3
4
+from msgpack import packb
5
6
7
+def test_canonical():
8
+ # This test serialises a dictionary 3 times.
9
+ # Without canonicalisation each serialisation would be different
10
+ # (on Python 2.6 anyway)
11
+ d = {'year': 1, 'month': 2, 'day': 3}
12
+ s1 = packb(d, canonical=True)
13
14
+ for i in range(30):
15
+ d[i] = i
16
17
+ del d[i]
18
+ s2 = packb(d, canonical=True)
19
20
+ d = dict(d)
21
+ s3 = packb(d, canonical=True)
22
23
+ eq_(s1, s2, s3)
24
25
+if __name__ == '__main__':
26
+ from nose import main
27
+ main()
0 commit comments