Skip to content

TST: skip decimal conversion tests on 32-bit #15922

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 6, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion pandas/tests/io/json/test_pandas.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# -*- coding: utf-8 -*-
# pylint: disable-msg=W0612,E1101
import pytest
from pandas.compat import range, lrange, StringIO, OrderedDict
from pandas.compat import (range, lrange, StringIO,
OrderedDict, is_platform_32bit)
import os

import numpy as np
Expand Down Expand Up @@ -380,6 +381,8 @@ def test_frame_from_json_nones(self):
unser = read_json(df.to_json(), dtype=False)
self.assertTrue(np.isnan(unser[2][0]))

@pytest.mark.skipif(is_platform_32bit(),
reason="not compliant on 32-bit, xref #15865")
def test_frame_to_json_float_precision(self):
df = pd.DataFrame([dict(a_float=0.95)])
encoded = df.to_json(double_precision=1)
Expand Down
26 changes: 6 additions & 20 deletions pandas/tests/io/json/test_ujson.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
import simplejson as json
import math
import pytest
import platform
import sys
import time
import datetime
import calendar
Expand All @@ -25,18 +23,14 @@
import pandas.util.testing as tm


def _skip_if_python_ver(skip_major, skip_minor=None):
major, minor = sys.version_info[:2]
if major == skip_major and (skip_minor is None or minor == skip_minor):
pytest.skip("skipping Python version %d.%d" % (major, minor))


json_unicode = (json.dumps if compat.PY3
else partial(json.dumps, encoding="utf-8"))


class UltraJSONTests(TestCase):

@pytest.mark.skipif(compat.is_platform_32bit(),
reason="not compliant on 32-bit, xref #15865")
def test_encodeDecimal(self):
sut = decimal.Decimal("1337.1337")
encoded = ujson.encode(sut, double_precision=15)
Expand Down Expand Up @@ -153,10 +147,9 @@ def test_decimalDecodeTestPrecise(self):
decoded = ujson.decode(encoded, precise_float=True)
self.assertEqual(sut, decoded)

@pytest.mark.skipif(compat.is_platform_windows() and not compat.PY3,
reason="buggy on win-64 for py2")
def test_encodeDoubleTinyExponential(self):
if compat.is_platform_windows() and not compat.PY3:
pytest.skip("buggy on win-64 for py2")

num = 1e-40
self.assertEqual(num, ujson.decode(ujson.encode(num)))
num = 1e-100
Expand Down Expand Up @@ -275,8 +268,6 @@ def test_encodeUnicodeConversion2(self):
self.assertEqual(dec, json.loads(enc))

def test_encodeUnicodeSurrogatePair(self):
_skip_if_python_ver(2, 5)
_skip_if_python_ver(2, 6)
input = "\xf0\x90\x8d\x86"
enc = ujson.encode(input)
dec = ujson.decode(enc)
Expand All @@ -285,8 +276,6 @@ def test_encodeUnicodeSurrogatePair(self):
self.assertEqual(dec, json.loads(enc))

def test_encodeUnicode4BytesUTF8(self):
_skip_if_python_ver(2, 5)
_skip_if_python_ver(2, 6)
input = "\xf0\x91\x80\xb0TRAILINGNORMAL"
enc = ujson.encode(input)
dec = ujson.decode(enc)
Expand All @@ -295,8 +284,6 @@ def test_encodeUnicode4BytesUTF8(self):
self.assertEqual(dec, json.loads(enc))

def test_encodeUnicode4BytesUTF8Highest(self):
_skip_if_python_ver(2, 5)
_skip_if_python_ver(2, 6)
input = "\xf3\xbf\xbf\xbfTRAILINGNORMAL"
enc = ujson.encode(input)

Expand Down Expand Up @@ -462,7 +449,6 @@ def test_datetime_units(self):
self.assertRaises(ValueError, ujson.encode, val, date_unit='foo')

def test_encodeToUTF8(self):
_skip_if_python_ver(2, 5)
input = "\xe6\x97\xa5\xd1\x88"
enc = ujson.encode(input, ensure_ascii=False)
dec = ujson.decode(enc)
Expand Down Expand Up @@ -696,8 +682,8 @@ def test_decodeNumericIntNeg(self):
input = "-31337"
self.assertEqual(-31337, ujson.decode(input))

@pytest.mark.skipif(compat.PY3, reason="only PY2")
def test_encodeUnicode4BytesUTF8Fail(self):
_skip_if_python_ver(3)
input = "\xfd\xbf\xbf\xbf\xbf\xbf"
try:
enc = ujson.encode(input) # noqa
Expand Down Expand Up @@ -1029,7 +1015,7 @@ def testIntMax(self):
num = np.uint32(np.iinfo(np.uint32).max)
self.assertEqual(np.uint32(ujson.decode(ujson.encode(num))), num)

if platform.architecture()[0] != '32bit':
if not compat.is_platform_32bit():
num = np.int64(np.iinfo(np.int64).max)
self.assertEqual(np.int64(ujson.decode(ujson.encode(num))), num)

Expand Down