question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

TST/CLN: remove TestData from series-tests; replace with fixtures

See original GitHub issue

This is the sister-issue for Series of #22471 (for frames), where the review in #22236 requested:

ok, pls open a new issue that refs this, to remove use of TestData in favor of fixtures

For Series, this process is started by #22526 by creating a conftest.py that translates all the current attributes of TestData to fixtures, with the following “translation guide”:

  • ts -> datetime_series
  • series -> string_series
  • objSeries -> object_series
  • empty -> empty_series

Need to incrementally replace their usages in pandas/tests/series/ (example below).

  • Create conftest.py and translate TestData-attributes into fixtures and renaming them them as outlined above (#22526)
  • test_alter_axes.py (#22526)
  • test_analytics.py (#22755)
  • test_api.py (#29153)
  • test_apply.py (#22769)
  • test_asof.py (#22772)
  • test_combine_concat.py (#22964)
  • test_constructors.py (#22965)
  • test_datetime_values.py (#22966)
  • test_dtypes.py (#22967)
  • test_io.py (#22972)
  • test_missing.py (#22973)
  • test_operators.py (#29084)
  • test_quantile.py (#29096)
  • test_rank.py (#29101)
  • test_replace.py (#29147)
  • test_repr.py (#29148)
  • test_sorting.py (#29149)
  • test_timeseries.py (#29150)
  • test_validate.py (#22756)

Things for follow-ups:

  • Remove other class-based test-methods
  • Turn tests from class- to function-based

An example from #22526 - before:

def test_rename_inplace(self):
    renamer = lambda x: x.strftime('%Y%m%d')
    expected = renamer(self.ts.index[0])
    self.ts.rename(renamer, inplace=True)
    assert self.ts.index[0] == expected

After:

def test_rename_inplace(self, datetime_series):
    renamer = lambda x: x.strftime('%Y%m%d')
    expected = renamer(datetime_series.index[0])
    datetime_series.rename(renamer, inplace=True)
    assert datetime_series.index[0] == expected

Basically, it comes down to replacing all the occurrences of self.<name> with translation_guide[<name>] (and specifying the latter as a parameter to the function).

PS. Note that some fixtures added by #22526 have now been removed by #24885. Please check #24885 which code was removed, in case you should need it for the fixturisation. Alternatively, you can ping me, @jbrockmendel or @jreback.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:8 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
SaturnFromTitancommented, Oct 25, 2019

I created the follow-up issue to remove _common.py for series tests. This one here can be closed @simonjayhawkins ✌️

EDIT: I’ll first need to remove TestData usage in pandas/tests/series/indexing

1reaction
SaturnFromTitancommented, Oct 22, 2019

test_arithmetic.py also doesn’t contain TestData, so after merging my pending PRs we can close this issue ✅

I guess the next step then would be to remove the pandas/tests/series/_common.py altogether

Read more comments on GitHub >

github_iconTop Results From Across the Web

2020-20201 TSTC College Catalog and Student Handbook
Resource Center on a Data Change Form although changes of address, email address, ... Enrollment in these courses is indicated by testing or...
Read more >
2021–2022 - College Catalog & Student Handbook
C. Comply with applicable testing requirements: i. Submitting TSI Assessment test results; or ii. Submitting documentation of TSI exemption or waiver; or.
Read more >
Addendum - Texas State Technical College
C. Comply with applicable testing requirements: 1. Submitting TSI Assessment Test results; or. 2. Submitting documentation of TSI exemption or waiver; or.
Read more >
Additional Testing - Texas State Technical College
Additional Testing. We provide testing services to assist you in assessing your knowledge and skills. ATI Test for Essential Academic Skills (TEAS). The...
Read more >
student handbook - Texas State Technical College
Student Drug and Alcohol Testing Policy - COP 4.36 ... Unauthorized access, use or misuse of college computing resources, systems or data.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found