@@ -1131,22 +1131,20 @@ def testArrayNumpyLabelled(self):
1131
1131
self .assertTrue (output [1 ] is None )
1132
1132
self .assertTrue ((np .array ([u ('a' )]) == output [2 ]).all ())
1133
1133
1134
- # py3 is non-determinstic on the ordering......
1135
- if not compat .PY3 :
1136
- input = [{'a' : 42 , 'b' :31 }, {'a' : 24 , 'c' : 99 }, {'a' : 2.4 , 'b' : 78 }]
1137
- output = ujson .loads (ujson .dumps (input ), numpy = True , labelled = True )
1138
- expectedvals = np .array ([42 , 31 , 24 , 99 , 2.4 , 78 ], dtype = int ).reshape ((3 ,2 ))
1139
- self .assertTrue ((expectedvals == output [0 ]).all ())
1140
- self .assertTrue (output [1 ] is None )
1141
- self .assertTrue ((np .array ([u ('a' ), 'b' ]) == output [2 ]).all ())
1142
-
1143
-
1144
- input = {1 : {'a' : 42 , 'b' :31 }, 2 : {'a' : 24 , 'c' : 99 }, 3 : {'a' : 2.4 , 'b' : 78 }}
1145
- output = ujson .loads (ujson .dumps (input ), numpy = True , labelled = True )
1146
- expectedvals = np .array ([42 , 31 , 24 , 99 , 2.4 , 78 ], dtype = int ).reshape ((3 ,2 ))
1147
- self .assertTrue ((expectedvals == output [0 ]).all ())
1148
- self .assertTrue ((np .array (['1' ,'2' ,'3' ]) == output [1 ]).all ())
1149
- self .assertTrue ((np .array (['a' , 'b' ]) == output [2 ]).all ())
1134
+ # Write out the dump explicitly so there is no dependency on iteration order GH10837
1135
+ input_dumps = '[{"a": 42, "b":31}, {"a": 24, "c": 99}, {"a": 2.4, "b": 78}]'
1136
+ output = ujson .loads (input_dumps , numpy = True , labelled = True )
1137
+ expectedvals = np .array ([42 , 31 , 24 , 99 , 2.4 , 78 ], dtype = int ).reshape ((3 , 2 ))
1138
+ self .assertTrue ((expectedvals == output [0 ]).all ())
1139
+ self .assertTrue (output [1 ] is None )
1140
+ self .assertTrue ((np .array ([u ('a' ), 'b' ]) == output [2 ]).all ())
1141
+
1142
+ input_dumps = '{"1": {"a": 42, "b":31}, "2": {"a": 24, "c": 99}, "3": {"a": 2.4, "b": 78}}'
1143
+ output = ujson .loads (input_dumps , numpy = True , labelled = True )
1144
+ expectedvals = np .array ([42 , 31 , 24 , 99 , 2.4 , 78 ], dtype = int ).reshape ((3 , 2 ))
1145
+ self .assertTrue ((expectedvals == output [0 ]).all ())
1146
+ self .assertTrue ((np .array (['1' , '2' , '3' ]) == output [1 ]).all ())
1147
+ self .assertTrue ((np .array (['a' , 'b' ]) == output [2 ]).all ())
1150
1148
1151
1149
1152
1150
class PandasJSONTests (TestCase ):
0 commit comments