|
|
@@ -796,11 +796,18 @@ if __name__ == '__main__': # pragma: no cover |
|
|
|
|
|
|
|
class _TestCononicalCoder(unittest.TestCase): |
|
|
|
def test_con(self): |
|
|
|
obja = { 'foo': 23984732, 'a': 5, 'b': 6, 'something': '2398472398723498273dfasdfjlaksdfj' } |
|
|
|
# make a dict |
|
|
|
obja = { |
|
|
|
'foo': 23984732, 'a': 5, 'b': 6, |
|
|
|
'something': '2398472398723498273dfasdfjlaksdfj' |
|
|
|
} |
|
|
|
|
|
|
|
# reorder the items in it |
|
|
|
objaitems = list(obja.items()) |
|
|
|
objaitems.sort() |
|
|
|
objb = dict(objaitems) |
|
|
|
|
|
|
|
# and they are still the same |
|
|
|
self.assertEqual(obja, objb) |
|
|
|
|
|
|
|
# This is to make sure that item order changed |
|
|
@@ -809,11 +816,14 @@ class _TestCononicalCoder(unittest.TestCase): |
|
|
|
astr = pasn1.dumps(obja) |
|
|
|
bstr = pasn1.dumps(objb) |
|
|
|
|
|
|
|
# that they normally will be serialized differently |
|
|
|
self.assertNotEqual(astr, bstr) |
|
|
|
|
|
|
|
# but w/ the special encoder |
|
|
|
astr = _asn1coder.dumps(obja) |
|
|
|
bstr = _asn1coder.dumps(objb) |
|
|
|
|
|
|
|
# they are now encoded the same |
|
|
|
self.assertEqual(astr, bstr) |
|
|
|
|
|
|
|
class _TestCases(unittest.TestCase): |
|
|
|