1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
|
From 56537fed91d5bd7cfa4ffb450daa629be7eb420c Mon Sep 17 00:00:00 2001
From: Tristan Seligmann <mithrandi@mithrandi.net>
Date: Wed, 14 Oct 2015 20:04:01 +0200
Subject: Use an OrderedDict to make the dict serialization test reliable.
---
tests.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/tests.py b/tests.py
index f6d7066..cc9bad9 100644
--- a/tests.py
+++ b/tests.py
@@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-
import unittest
import phpserialize
+from collections import OrderedDict
class PhpSerializeTestCase(unittest.TestCase):
@@ -32,7 +33,7 @@ class PhpSerializeTestCase(unittest.TestCase):
b'a:3:{i:0;i:7;i:1;i:8;i:2;i:9;}')
def test_dumps_dict(self):
- self.assertEqual(phpserialize.dumps({'a': 1, 'b': 2, 'c': 3}),
+ self.assertEqual(phpserialize.dumps(OrderedDict([('a', 1), ('c', 3), ('b', 2)])),
b'a:3:{s:1:"a";i:1;s:1:"c";i:3;s:1:"b";i:2;}')
def test_loads_dict(self):
|