Skip to content

TST: indexing/test_floats.py::TestFloatIndexers::test_scalar_non_numeric #25748

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

Closed

Conversation

simonjayhawkins
Copy link
Member

@simonjayhawkins simonjayhawkins commented Mar 16, 2019

precursor to #25750

This test has some commented out code with a pytest.raises not used as a context manager.

The goal here is primarily to remove the commented out code.

some refactoring but not enough to allow full parametrization.

@codecov
Copy link

codecov bot commented Mar 17, 2019

Codecov Report

Merging #25748 into master will decrease coverage by <.01%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #25748      +/-   ##
==========================================
- Coverage   91.25%   91.25%   -0.01%     
==========================================
  Files         172      172              
  Lines       52977    52977              
==========================================
- Hits        48343    48342       -1     
- Misses       4634     4635       +1
Flag Coverage Δ
#multiple 89.82% <ø> (ø) ⬆️
#single 41.74% <ø> (ø) ⬆️
Impacted Files Coverage Δ
pandas/util/testing.py 88.98% <0%> (-0.1%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 65c0441...34e98e6. Read the comment docs.

1 similar comment
@codecov
Copy link

codecov bot commented Mar 17, 2019

Codecov Report

Merging #25748 into master will decrease coverage by <.01%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #25748      +/-   ##
==========================================
- Coverage   91.25%   91.25%   -0.01%     
==========================================
  Files         172      172              
  Lines       52977    52977              
==========================================
- Hits        48343    48342       -1     
- Misses       4634     4635       +1
Flag Coverage Δ
#multiple 89.82% <ø> (ø) ⬆️
#single 41.74% <ø> (ø) ⬆️
Impacted Files Coverage Δ
pandas/util/testing.py 88.98% <0%> (-0.1%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 65c0441...34e98e6. Read the comment docs.


# contains
assert 3.0 not in s
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i guess that maybe this should have been assert 3.0 not in i

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is i?

@jreback jreback added the Testing pandas testing functions or related to the test suite label Mar 18, 2019
Copy link
Contributor

@jreback jreback left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

quick looks seems this is not much more clear than the original. maybe split get/set will be helpful

@@ -61,109 +61,115 @@ def test_scalar_error(self):
s.iloc[3.0] = 0

@ignore_ix
def test_scalar_non_numeric(self):
@pytest.mark.parametrize('index', [
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think we already have a fixture for these


# contains
assert 3.0 not in s
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is i?

@jreback jreback added the Indexing Related to indexing on series/frames, not to indexes themselves label Mar 18, 2019
@simonjayhawkins
Copy link
Member Author

quick looks seems this is not much more clear than the original.

i agree. the main change is to include the cases that were skipped (not in the pytest.skip sense but in the pass or commented out sense.

maybe split get/set will be helpful

i agree that there is basically only two tests here: idxr(obj)[3.0] and idxr(obj)[3.0] = 0
however, if we are checking for consistency of error messages then having them in the same parametrised test may be an advantage. (would also eliminate need for duplicating parametrisation or creating fixtures)
would you be adverse to something like..

@pytest.mark.parametrize('pass', ['getting', 'setting'])
def ...
    if pass == 'getting':
        # getting
         ...
         idxr(obj)[3.0]
    else:
        # setting
        ...
        idxr(obj)[3.0] = 0

also note that it is relatively straightforward to remove iloc completely from this test (and most of the other tests in this module) as it is tested at the start of the module, which make sense for float indexing with iloc. I felt that was out of scope for this PR. A precursor PR to refactor iloc would certainly make the test look less cluttered.

@jreback
Copy link
Contributor

jreback commented Mar 19, 2019

also note that it is relatively straightforward to remove iloc completely from this test (and most of the other tests in this module) as it is tested at the start of the module, which make sense for float indexing with iloc. I felt that was out of scope for this PR. A precursor PR to refactor iloc would certainly make the test look less cluttered.

if you don't mind that would be great.

@simonjayhawkins
Copy link
Member Author

superseded by #25866

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Indexing Related to indexing on series/frames, not to indexes themselves Testing pandas testing functions or related to the test suite
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants