Skip to content

Commit 6f5bfaf

Browse files
committed
Fix conftest.py scoping and refactor tests as classes.
1 parent bf63d76 commit 6f5bfaf

File tree

4 files changed

+677
-689
lines changed

4 files changed

+677
-689
lines changed

tests/conftest.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16,26 +16,26 @@
1616
NUM_SERIES = "NUMBER OF PERSONS INJURED"
1717

1818

19-
@pytest.fixture
20-
def test_df(scope="package"): # pylint: disable=W0613
19+
@pytest.fixture(scope="package")
20+
def test_df():
2121
"""Return test pd.DataFrame from sample of NYC collisions dataset."""
2222
return pd.read_csv(os.path.join(TEST_DATA_DIR, TEST_DATA_FILE))
2323

2424

25-
@pytest.fixture
26-
def cat_like_series(test_df, scope="package"): # pylint: disable=W0613,W0621
25+
@pytest.fixture(scope="package")
26+
def cat_like_series(test_df): # pylint: disable=W0621
2727
"""Return categorical-like (object) series."""
2828
return test_df[CAT_SERIES]
2929

3030

31-
@pytest.fixture
32-
def num_series(test_df, scope="package"): # pylint: disable=W0613,W0621
31+
@pytest.fixture(scope="package")
32+
def num_series(test_df): # pylint: disable=W0621
3333
"""Return numerical series."""
3434
return test_df[NUM_SERIES]
3535

3636

37-
@pytest.fixture
38-
def non_series_invalid(scope="package"): # pylint: disable=W0613
37+
@pytest.fixture(scope="package")
38+
def non_series_invalid():
3939
"""Provide list of non-pd.Series, invalid data types."""
4040
invalid_types = [
4141
None,
@@ -56,8 +56,8 @@ def non_series_invalid(scope="package"): # pylint: disable=W0613
5656
return invalid_types
5757

5858

59-
@pytest.fixture
60-
def simple_df(scope="package"): # pylint: disable=W0613
59+
@pytest.fixture(scope="package")
60+
def simple_df():
6161
"""Return test pd.DataFrame with DatetimeIndex."""
6262
start = pd.Timestamp(year=1999, month=1, day=1)
6363
end = start + pd.Timedelta(hours=10)
@@ -66,8 +66,8 @@ def simple_df(scope="package"): # pylint: disable=W0613
6666
return df
6767

6868

69-
@pytest.fixture
70-
def ts_timeindex(scope="package"): # pylint: disable=W0613
69+
@pytest.fixture(scope="package")
70+
def ts_timeindex():
7171
"""Return pd.Series of type datetime64 with DatetimeIndex."""
7272
start = pd.Timestamp(year=1999, month=1, day=1)
7373
end = start + pd.Timedelta(hours=40)
@@ -77,8 +77,8 @@ def ts_timeindex(scope="package"): # pylint: disable=W0613
7777
return time_series
7878

7979

80-
@pytest.fixture
81-
def cat_df(scope="package"): # pylint: disable=W0613
80+
@pytest.fixture(scope="package")
81+
def cat_df():
8282
"""Return pd.DataFrame with DatetimeIndex."""
8383
start = pd.Timestamp(year=1999, month=1, day=1)
8484
end = start + pd.Timedelta(days=365)

0 commit comments

Comments
 (0)