Skip to content

Commit

Permalink
MAINT: Remove unittest.TestCase from testing
Browse files Browse the repository at this point in the history
  • Loading branch information
gfyoung committed May 3, 2017
1 parent 69c9d56 commit b11bd87
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 28 deletions.
4 changes: 2 additions & 2 deletions pandas/tests/frame/test_validate.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
from unittest import TestCase
from pandas.core.frame import DataFrame

import pandas.util.testing as tm
import pytest


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

Expand Down
8 changes: 3 additions & 5 deletions pandas/tests/io/json/test_ujson.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# -*- coding: utf-8 -*-

from unittest import TestCase

try:
import json
except ImportError:
Expand All @@ -27,7 +25,7 @@
else partial(json.dumps, encoding="utf-8"))


class UltraJSONTests(TestCase):
class UltraJSONTests(tm.TestCase):

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


class NumpyJSONTests(TestCase):
class NumpyJSONTests(tm.TestCase):

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


class PandasJSONTests(TestCase):
class PandasJSONTests(tm.TestCase):

def testDataFrame(self):
df = DataFrame([[1, 2, 3], [4, 5, 6]], index=[
Expand Down
21 changes: 10 additions & 11 deletions pandas/tests/io/test_sql.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
from __future__ import print_function
from warnings import catch_warnings
import pytest
import unittest
import sqlite3
import csv
import os
Expand Down Expand Up @@ -819,7 +818,7 @@ def test_unicode_column_name(self):


@pytest.mark.single
class TestSQLApi(SQLAlchemyMixIn, _TestSQLApi, unittest.TestCase):
class TestSQLApi(SQLAlchemyMixIn, _TestSQLApi, tm.TestCase):
"""
Test the public API as it would be used directly
Expand Down Expand Up @@ -999,12 +998,12 @@ def teardown_method(self, method):


@pytest.mark.single
class TestSQLApiConn(_EngineToConnMixin, TestSQLApi, unittest.TestCase):
class TestSQLApiConn(_EngineToConnMixin, TestSQLApi, tm.TestCase):
pass


@pytest.mark.single
class TestSQLiteFallbackApi(SQLiteMixIn, _TestSQLApi, unittest.TestCase):
class TestSQLiteFallbackApi(SQLiteMixIn, _TestSQLApi, tm.TestCase):
"""
Test the public sqlite connection fallback API
Expand Down Expand Up @@ -1822,45 +1821,45 @@ def test_schema_support(self):


@pytest.mark.single
class TestMySQLAlchemy(_TestMySQLAlchemy, _TestSQLAlchemy, unittest.TestCase):
class TestMySQLAlchemy(_TestMySQLAlchemy, _TestSQLAlchemy, tm.TestCase):
pass


@pytest.mark.single
class TestMySQLAlchemyConn(_TestMySQLAlchemy, _TestSQLAlchemyConn,
unittest.TestCase):
tm.TestCase):
pass


@pytest.mark.single
class TestPostgreSQLAlchemy(_TestPostgreSQLAlchemy, _TestSQLAlchemy,
unittest.TestCase):
tm.TestCase):
pass


@pytest.mark.single
class TestPostgreSQLAlchemyConn(_TestPostgreSQLAlchemy, _TestSQLAlchemyConn,
unittest.TestCase):
tm.TestCase):
pass


@pytest.mark.single
class TestSQLiteAlchemy(_TestSQLiteAlchemy, _TestSQLAlchemy,
unittest.TestCase):
tm.TestCase):
pass


@pytest.mark.single
class TestSQLiteAlchemyConn(_TestSQLiteAlchemy, _TestSQLAlchemyConn,
unittest.TestCase):
tm.TestCase):
pass


# -----------------------------------------------------------------------------
# -- Test Sqlite / MySQL fallback

@pytest.mark.single
class TestSQLiteFallback(SQLiteMixIn, PandasSQLTest, unittest.TestCase):
class TestSQLiteFallback(SQLiteMixIn, PandasSQLTest, tm.TestCase):
"""
Test the fallback mode against an in-memory sqlite database.
Expand Down
3 changes: 1 addition & 2 deletions pandas/tests/sparse/test_list.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from pandas.compat import range
import unittest

from numpy import nan
import numpy as np
Expand All @@ -8,7 +7,7 @@
import pandas.util.testing as tm


class TestSparseList(unittest.TestCase):
class TestSparseList(tm.TestCase):

def setup_method(self, method):
self.na_data = np.array([nan, nan, 1, 2, 3, nan, 4, 5, nan, 6])
Expand Down
5 changes: 3 additions & 2 deletions pandas/tests/test_config.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
# -*- coding: utf-8 -*-
import pytest

import pandas.util.testing as tm
import pandas as pd
import unittest

import warnings


class TestConfig(unittest.TestCase):
class TestConfig(tm.TestCase):

def __init__(self, *args):
super(TestConfig, self).__init__(*args)
Expand Down
7 changes: 3 additions & 4 deletions pandas/tests/test_testing.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# -*- coding: utf-8 -*-
import pandas as pd
import unittest
import pytest
import numpy as np
import sys
Expand Down Expand Up @@ -340,7 +339,7 @@ def test_assert_almost_equal_iterable_message(self):
assert_almost_equal([1, 2], [1, 3])


class TestAssertIndexEqual(unittest.TestCase):
class TestAssertIndexEqual(tm.TestCase):

def test_index_equal_message(self):

Expand Down Expand Up @@ -680,7 +679,7 @@ def test_frame_equal_message(self):
by_blocks=True)


class TestAssertCategoricalEqual(unittest.TestCase):
class TestAssertCategoricalEqual(tm.TestCase):

def test_categorical_equal_message(self):

Expand Down Expand Up @@ -718,7 +717,7 @@ def test_categorical_equal_message(self):
tm.assert_categorical_equal(a, b)


class TestRNGContext(unittest.TestCase):
class TestRNGContext(tm.TestCase):

def test_RNGContext(self):
expected0 = 1.764052345967664
Expand Down
4 changes: 2 additions & 2 deletions pandas/tests/test_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -559,11 +559,11 @@ def test_deprecations(self):
mom.rolling_mean(Series(np.ones(10)), 3, center=True, axis=0)


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

0 comments on commit b11bd87

Please sign in to comment.