Skip to content

Commit 8d63290

Browse files
committed
MAINT: Remove unittest.TestCase from testing
1 parent bfb11c5 commit 8d63290

File tree

7 files changed

+24
-28
lines changed

7 files changed

+24
-28
lines changed

pandas/tests/frame/test_validate.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
from unittest import TestCase
21
from pandas.core.frame import DataFrame
32

3+
import pandas.util.testing as tm
44
import pytest
55

66

7-
class TestDataFrameValidate(TestCase):
7+
class TestDataFrameValidate(tm.TestCase):
88
"""Tests for error handling related to data types of method arguments."""
99
df = DataFrame({'a': [1, 2], 'b': [3, 4]})
1010

pandas/tests/io/json/test_ujson.py

+3-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
# -*- coding: utf-8 -*-
22

3-
from unittest import TestCase
4-
53
try:
64
import json
75
except ImportError:
@@ -27,7 +25,7 @@
2725
else partial(json.dumps, encoding="utf-8"))
2826

2927

30-
class UltraJSONTests(TestCase):
28+
class UltraJSONTests(tm.TestCase):
3129

3230
@pytest.mark.skipif(compat.is_platform_32bit(),
3331
reason="not compliant on 32-bit, xref #15865")
@@ -948,7 +946,7 @@ def my_obj_handler(obj):
948946
ujson.decode(ujson.encode(l, default_handler=str)))
949947

950948

951-
class NumpyJSONTests(TestCase):
949+
class NumpyJSONTests(tm.TestCase):
952950

953951
def testBool(self):
954952
b = np.bool(True)
@@ -1224,7 +1222,7 @@ def testArrayNumpyLabelled(self):
12241222
assert (np.array(['a', 'b']) == output[2]).all()
12251223

12261224

1227-
class PandasJSONTests(TestCase):
1225+
class PandasJSONTests(tm.TestCase):
12281226

12291227
def testDataFrame(self):
12301228
df = DataFrame([[1, 2, 3], [4, 5, 6]], index=[

pandas/tests/io/test_sql.py

+10-11
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
from __future__ import print_function
2121
from warnings import catch_warnings
2222
import pytest
23-
import unittest
2423
import sqlite3
2524
import csv
2625
import os
@@ -819,7 +818,7 @@ def test_unicode_column_name(self):
819818

820819

821820
@pytest.mark.single
822-
class TestSQLApi(SQLAlchemyMixIn, _TestSQLApi, unittest.TestCase):
821+
class TestSQLApi(SQLAlchemyMixIn, _TestSQLApi, tm.TestCase):
823822
"""
824823
Test the public API as it would be used directly
825824
@@ -999,12 +998,12 @@ def teardown_method(self, method):
999998

1000999

10011000
@pytest.mark.single
1002-
class TestSQLApiConn(_EngineToConnMixin, TestSQLApi, unittest.TestCase):
1001+
class TestSQLApiConn(_EngineToConnMixin, TestSQLApi, tm.TestCase):
10031002
pass
10041003

10051004

10061005
@pytest.mark.single
1007-
class TestSQLiteFallbackApi(SQLiteMixIn, _TestSQLApi, unittest.TestCase):
1006+
class TestSQLiteFallbackApi(SQLiteMixIn, _TestSQLApi, tm.TestCase):
10081007
"""
10091008
Test the public sqlite connection fallback API
10101009
@@ -1822,45 +1821,45 @@ def test_schema_support(self):
18221821

18231822

18241823
@pytest.mark.single
1825-
class TestMySQLAlchemy(_TestMySQLAlchemy, _TestSQLAlchemy, unittest.TestCase):
1824+
class TestMySQLAlchemy(_TestMySQLAlchemy, _TestSQLAlchemy, tm.TestCase):
18261825
pass
18271826

18281827

18291828
@pytest.mark.single
18301829
class TestMySQLAlchemyConn(_TestMySQLAlchemy, _TestSQLAlchemyConn,
1831-
unittest.TestCase):
1830+
tm.TestCase):
18321831
pass
18331832

18341833

18351834
@pytest.mark.single
18361835
class TestPostgreSQLAlchemy(_TestPostgreSQLAlchemy, _TestSQLAlchemy,
1837-
unittest.TestCase):
1836+
tm.TestCase):
18381837
pass
18391838

18401839

18411840
@pytest.mark.single
18421841
class TestPostgreSQLAlchemyConn(_TestPostgreSQLAlchemy, _TestSQLAlchemyConn,
1843-
unittest.TestCase):
1842+
tm.TestCase):
18441843
pass
18451844

18461845

18471846
@pytest.mark.single
18481847
class TestSQLiteAlchemy(_TestSQLiteAlchemy, _TestSQLAlchemy,
1849-
unittest.TestCase):
1848+
tm.TestCase):
18501849
pass
18511850

18521851

18531852
@pytest.mark.single
18541853
class TestSQLiteAlchemyConn(_TestSQLiteAlchemy, _TestSQLAlchemyConn,
1855-
unittest.TestCase):
1854+
tm.TestCase):
18561855
pass
18571856

18581857

18591858
# -----------------------------------------------------------------------------
18601859
# -- Test Sqlite / MySQL fallback
18611860

18621861
@pytest.mark.single
1863-
class TestSQLiteFallback(SQLiteMixIn, PandasSQLTest, unittest.TestCase):
1862+
class TestSQLiteFallback(SQLiteMixIn, PandasSQLTest, tm.TestCase):
18641863
"""
18651864
Test the fallback mode against an in-memory sqlite database.
18661865

pandas/tests/sparse/test_list.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
from pandas.compat import range
2-
import unittest
32

43
from numpy import nan
54
import numpy as np
@@ -8,7 +7,7 @@
87
import pandas.util.testing as tm
98

109

11-
class TestSparseList(unittest.TestCase):
10+
class TestSparseList(tm.TestCase):
1211

1312
def setup_method(self, method):
1413
self.na_data = np.array([nan, nan, 1, 2, 3, nan, 4, 5, nan, 6])

pandas/tests/test_config.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
# -*- coding: utf-8 -*-
22
import pytest
33

4+
import pandas.util.testing as tm
45
import pandas as pd
5-
import unittest
6+
67
import warnings
78

89

9-
class TestConfig(unittest.TestCase):
10+
class TestConfig(tm.TestCase):
1011

1112
def __init__(self, *args):
1213
super(TestConfig, self).__init__(*args)

pandas/tests/test_testing.py

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
# -*- coding: utf-8 -*-
22
import pandas as pd
3-
import unittest
43
import pytest
54
import numpy as np
65
import sys
@@ -340,7 +339,7 @@ def test_assert_almost_equal_iterable_message(self):
340339
assert_almost_equal([1, 2], [1, 3])
341340

342341

343-
class TestAssertIndexEqual(unittest.TestCase):
342+
class TestAssertIndexEqual(tm.TestCase):
344343

345344
def test_index_equal_message(self):
346345

@@ -680,7 +679,7 @@ def test_frame_equal_message(self):
680679
by_blocks=True)
681680

682681

683-
class TestAssertCategoricalEqual(unittest.TestCase):
682+
class TestAssertCategoricalEqual(tm.TestCase):
684683

685684
def test_categorical_equal_message(self):
686685

@@ -718,7 +717,7 @@ def test_categorical_equal_message(self):
718717
tm.assert_categorical_equal(a, b)
719718

720719

721-
class TestRNGContext(unittest.TestCase):
720+
class TestRNGContext(tm.TestCase):
722721

723722
def test_RNGContext(self):
724723
expected0 = 1.764052345967664

pandas/tests/test_window.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -559,11 +559,11 @@ def test_deprecations(self):
559559
mom.rolling_mean(Series(np.ones(10)), 3, center=True, axis=0)
560560

561561

562-
# GH #12373 : rolling functions error on float32 data
562+
# gh-12373 : rolling functions error on float32 data
563563
# make sure rolling functions works for different dtypes
564564
#
565565
# NOTE that these are yielded tests and so _create_data is
566-
# explicity called, nor do these inherit from unittest.TestCase
566+
# explicity called, nor do these inherit from tm.TestCase
567567
#
568568
# further note that we are only checking rolling for fully dtype
569569
# compliance (though both expanding and ewm inherit)

0 commit comments

Comments
 (0)