88 import simplejson as json
99import math
1010import pytest
11- import platform
12- import sys
1311import time
1412import datetime
1513import calendar
2523import pandas .util .testing as tm
2624
2725
28- def _skip_if_python_ver (skip_major , skip_minor = None ):
29- major , minor = sys .version_info [:2 ]
30- if major == skip_major and (skip_minor is None or minor == skip_minor ):
31- pytest .skip ("skipping Python version %d.%d" % (major , minor ))
32-
33-
3426json_unicode = (json .dumps if compat .PY3
3527 else partial (json .dumps , encoding = "utf-8" ))
3628
3729
3830class UltraJSONTests (TestCase ):
3931
32+ @pytest .mark .skipif (compat .is_platform_32bit (),
33+ reason = "not compliant on 32-bit, xref #15865" )
4034 def test_encodeDecimal (self ):
4135 sut = decimal .Decimal ("1337.1337" )
4236 encoded = ujson .encode (sut , double_precision = 15 )
@@ -153,10 +147,9 @@ def test_decimalDecodeTestPrecise(self):
153147 decoded = ujson .decode (encoded , precise_float = True )
154148 self .assertEqual (sut , decoded )
155149
150+ @pytest .mark .skipif (compat .is_platform_windows () and not compat .PY3 ,
151+ reason = "buggy on win-64 for py2" )
156152 def test_encodeDoubleTinyExponential (self ):
157- if compat .is_platform_windows () and not compat .PY3 :
158- pytest .skip ("buggy on win-64 for py2" )
159-
160153 num = 1e-40
161154 self .assertEqual (num , ujson .decode (ujson .encode (num )))
162155 num = 1e-100
@@ -275,8 +268,6 @@ def test_encodeUnicodeConversion2(self):
275268 self .assertEqual (dec , json .loads (enc ))
276269
277270 def test_encodeUnicodeSurrogatePair (self ):
278- _skip_if_python_ver (2 , 5 )
279- _skip_if_python_ver (2 , 6 )
280271 input = "\xf0 \x90 \x8d \x86 "
281272 enc = ujson .encode (input )
282273 dec = ujson .decode (enc )
@@ -285,8 +276,6 @@ def test_encodeUnicodeSurrogatePair(self):
285276 self .assertEqual (dec , json .loads (enc ))
286277
287278 def test_encodeUnicode4BytesUTF8 (self ):
288- _skip_if_python_ver (2 , 5 )
289- _skip_if_python_ver (2 , 6 )
290279 input = "\xf0 \x91 \x80 \xb0 TRAILINGNORMAL"
291280 enc = ujson .encode (input )
292281 dec = ujson .decode (enc )
@@ -295,8 +284,6 @@ def test_encodeUnicode4BytesUTF8(self):
295284 self .assertEqual (dec , json .loads (enc ))
296285
297286 def test_encodeUnicode4BytesUTF8Highest (self ):
298- _skip_if_python_ver (2 , 5 )
299- _skip_if_python_ver (2 , 6 )
300287 input = "\xf3 \xbf \xbf \xbf TRAILINGNORMAL"
301288 enc = ujson .encode (input )
302289
@@ -462,7 +449,6 @@ def test_datetime_units(self):
462449 self .assertRaises (ValueError , ujson .encode , val , date_unit = 'foo' )
463450
464451 def test_encodeToUTF8 (self ):
465- _skip_if_python_ver (2 , 5 )
466452 input = "\xe6 \x97 \xa5 \xd1 \x88 "
467453 enc = ujson .encode (input , ensure_ascii = False )
468454 dec = ujson .decode (enc )
@@ -696,8 +682,8 @@ def test_decodeNumericIntNeg(self):
696682 input = "-31337"
697683 self .assertEqual (- 31337 , ujson .decode (input ))
698684
685+ @pytest .mark .skipif (compat .PY3 , reason = "only PY2" )
699686 def test_encodeUnicode4BytesUTF8Fail (self ):
700- _skip_if_python_ver (3 )
701687 input = "\xfd \xbf \xbf \xbf \xbf \xbf "
702688 try :
703689 enc = ujson .encode (input ) # noqa
@@ -1029,7 +1015,7 @@ def testIntMax(self):
10291015 num = np .uint32 (np .iinfo (np .uint32 ).max )
10301016 self .assertEqual (np .uint32 (ujson .decode (ujson .encode (num ))), num )
10311017
1032- if platform . architecture ()[ 0 ] != '32bit' :
1018+ if not compat . is_platform_32bit () :
10331019 num = np .int64 (np .iinfo (np .int64 ).max )
10341020 self .assertEqual (np .int64 (ujson .decode (ujson .encode (num ))), num )
10351021
0 commit comments