Skip to content

TST: ujson tests are not being run (#16499) #16500

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 3 commits into from
May 26, 2017
Merged
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
44 changes: 22 additions & 22 deletions pandas/tests/io/json/test_ujson.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
else partial(json.dumps, encoding="utf-8"))


class UltraJSONTests(object):
class TestUltraJSONTests(object):

@pytest.mark.skipif(compat.is_platform_32bit(),
reason="not compliant on 32-bit, xref #15865")
Expand Down Expand Up @@ -944,19 +944,19 @@ def my_obj_handler(obj):
ujson.decode(ujson.encode(l, default_handler=str)))


class NumpyJSONTests(object):
class TestNumpyJSONTests(object):

def testBool(self):
def test_Bool(self):
b = np.bool(True)
assert ujson.decode(ujson.encode(b)) == b

def testBoolArray(self):
def test_BoolArray(self):
inpt = np.array([True, False, True, True, False, True, False, False],
dtype=np.bool)
outp = np.array(ujson.decode(ujson.encode(inpt)), dtype=np.bool)
tm.assert_numpy_array_equal(inpt, outp)

def testInt(self):
def test_Int(self):
num = np.int(2562010)
assert np.int(ujson.decode(ujson.encode(num))) == num

Expand Down Expand Up @@ -984,7 +984,7 @@ def testInt(self):
num = np.uint64(2562010)
assert np.uint64(ujson.decode(ujson.encode(num))) == num

def testIntArray(self):
def test_IntArray(self):
arr = np.arange(100, dtype=np.int)
dtypes = (np.int, np.int8, np.int16, np.int32, np.int64,
np.uint, np.uint8, np.uint16, np.uint32, np.uint64)
Expand All @@ -993,7 +993,7 @@ def testIntArray(self):
outp = np.array(ujson.decode(ujson.encode(inpt)), dtype=dtype)
tm.assert_numpy_array_equal(inpt, outp)

def testIntMax(self):
def test_IntMax(self):
num = np.int(np.iinfo(np.int).max)
assert np.int(ujson.decode(ujson.encode(num))) == num

Expand Down Expand Up @@ -1023,7 +1023,7 @@ def testIntMax(self):
num = np.uint64(np.iinfo(np.int64).max)
assert np.uint64(ujson.decode(ujson.encode(num))) == num

def testFloat(self):
def test_Float(self):
num = np.float(256.2013)
assert np.float(ujson.decode(ujson.encode(num))) == num

Expand All @@ -1033,7 +1033,7 @@ def testFloat(self):
num = np.float64(256.2013)
assert np.float64(ujson.decode(ujson.encode(num))) == num

def testFloatArray(self):
def test_FloatArray(self):
arr = np.arange(12.5, 185.72, 1.7322, dtype=np.float)
dtypes = (np.float, np.float32, np.float64)

Expand All @@ -1043,7 +1043,7 @@ def testFloatArray(self):
inpt, double_precision=15)), dtype=dtype)
tm.assert_almost_equal(inpt, outp)

def testFloatMax(self):
def test_FloatMax(self):
num = np.float(np.finfo(np.float).max / 10)
tm.assert_almost_equal(np.float(ujson.decode(
ujson.encode(num, double_precision=15))), num, 15)
Expand All @@ -1056,7 +1056,7 @@ def testFloatMax(self):
tm.assert_almost_equal(np.float64(ujson.decode(
ujson.encode(num, double_precision=15))), num, 15)

def testArrays(self):
def test_Arrays(self):
arr = np.arange(100)

arr = arr.reshape((10, 10))
Expand Down Expand Up @@ -1097,13 +1097,13 @@ def testArrays(self):
outp = ujson.decode(ujson.encode(arr), numpy=True, dtype=np.float32)
tm.assert_almost_equal(arr, outp)

def testOdArray(self):
def test_OdArray(self):
def will_raise():
ujson.encode(np.array(1))

pytest.raises(TypeError, will_raise)

def testArrayNumpyExcept(self):
def test_ArrayNumpyExcept(self):

input = ujson.dumps([42, {}, 'a'])
try:
Expand Down Expand Up @@ -1186,7 +1186,7 @@ def testArrayNumpyExcept(self):
except:
assert False, "Wrong exception"

def testArrayNumpyLabelled(self):
def test_ArrayNumpyLabelled(self):
input = {'a': []}
output = ujson.loads(ujson.dumps(input), numpy=True, labelled=True)
assert (np.empty((1, 0)) == output[0]).all()
Expand Down Expand Up @@ -1220,9 +1220,9 @@ def testArrayNumpyLabelled(self):
assert (np.array(['a', 'b']) == output[2]).all()


class PandasJSONTests(object):
class TestPandasJSONTests(object):

def testDataFrame(self):
def test_DataFrame(self):
df = DataFrame([[1, 2, 3], [4, 5, 6]], index=[
'a', 'b'], columns=['x', 'y', 'z'])

Expand Down Expand Up @@ -1252,7 +1252,7 @@ def testDataFrame(self):
tm.assert_index_equal(df.transpose().columns, outp.columns)
tm.assert_index_equal(df.transpose().index, outp.index)

def testDataFrameNumpy(self):
def test_DataFrameNumpy(self):
df = DataFrame([[1, 2, 3], [4, 5, 6]], index=[
'a', 'b'], columns=['x', 'y', 'z'])

Expand All @@ -1275,7 +1275,7 @@ def testDataFrameNumpy(self):
tm.assert_index_equal(df.transpose().columns, outp.columns)
tm.assert_index_equal(df.transpose().index, outp.index)

def testDataFrameNested(self):
def test_DataFrameNested(self):
df = DataFrame([[1, 2, 3], [4, 5, 6]], index=[
'a', 'b'], columns=['x', 'y', 'z'])

Expand All @@ -1301,7 +1301,7 @@ def testDataFrameNested(self):
'df2': ujson.decode(ujson.encode(df, orient="split"))}
assert ujson.decode(ujson.encode(nested, orient="split")) == exp

def testDataFrameNumpyLabelled(self):
def test_DataFrameNumpyLabelled(self):
df = DataFrame([[1, 2, 3], [4, 5, 6]], index=[
'a', 'b'], columns=['x', 'y', 'z'])

Expand All @@ -1324,7 +1324,7 @@ def testDataFrameNumpyLabelled(self):
tm.assert_index_equal(df.columns, outp.columns)
tm.assert_index_equal(df.index, outp.index)

def testSeries(self):
def test_Series(self):
s = Series([10, 20, 30, 40, 50, 60], name="series",
index=[6, 7, 8, 9, 10, 15]).sort_values()

Expand Down Expand Up @@ -1372,7 +1372,7 @@ def testSeries(self):
s, orient="index"), numpy=True)).sort_values()
tm.assert_series_equal(outp, exp)

def testSeriesNested(self):
def test_SeriesNested(self):
s = Series([10, 20, 30, 40, 50, 60], name="series",
index=[6, 7, 8, 9, 10, 15]).sort_values()

Expand All @@ -1398,7 +1398,7 @@ def testSeriesNested(self):
's2': ujson.decode(ujson.encode(s, orient="index"))}
assert ujson.decode(ujson.encode(nested, orient="index")) == exp

def testIndex(self):
def test_Index(self):
i = Index([23, 45, 18, 98, 43, 11], name="index")

# column indexed
Expand Down