Skip to content
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

TST: Regression testing for fixed issues #30554

Merged
merged 5 commits into from
Dec 31, 2019

Conversation

@mroeschke mroeschke added the Testing pandas testing functions or related to the test suite label Dec 30, 2019
def test_get_indexer_nan(self):
# GH 7820
result = Index([1, 2, np.nan]).get_indexer([np.nan])
expected = np.array([2])
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
expected = np.array([2])
expected = np.array([2], dtype=np.intp)

@simonjayhawkins simonjayhawkins added this to the 1.0 milestone Dec 30, 2019
buf = io.StringIO()
s.to_csv(buf)
result = buf.getvalue()
expected = ",0\n0,0 days 00:00:00.000000001\n1,0 days 00:00:00.000000001\n"
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
expected = ",0\n0,0 days 00:00:00.000000001\n1,0 days 00:00:00.000000001\n"
expected_rows = [
",0",
"0,0 days 00:00:00.000000001",
"1,0 days 00:00:00.000000001",
]
expected = tm.convert_rows_list_to_csv_str(expected_rows)

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.

lgtm. merge on green.

@TomAugspurger
Copy link
Contributor

Fixed one of the 32-bit failures. We may have a remaining one that I don't immediately see a fix for.

    def test_to_csv_timedelta_precision(self):
        # GH 6783
        s = pd.Series([1, 1]).astype("timedelta64[ns]")
        buf = io.StringIO()
        s.to_csv(buf)
        result = buf.getvalue()
        expected = ",0\n0,0 days 00:00:00.000000001\n1,0 days 00:00:00.000000001\n"
>       assert result == expected
E       AssertionError: assert ',0\r\n0,0 da...000000001\r\n' == ',0\n0,0 days...0.000000001\n'
E         - ,0

E         ?   -
E         + ,0
E         - 0,0 days 00:00:00.000000001

E         ?                            -
E         + 0,0 days 00:00:00.000000001
E         - 1,0 days 00:00:00.000000001
...
E         
E         ...Full output truncated (3 lines hidden), use '-vv' to show

@jbrockmendel
Copy link
Member

at least one of the failures looks like a np.intp thing

@TomAugspurger
Copy link
Contributor

Strange, on the 32-bit linux build we have

self = <pandas.tests.indexes.test_numeric.TestInt64Index object at 0xd35cbbcc>

    def test_get_indexer_nan(self):
        # GH 7820
        result = Index([1, 2, np.nan]).get_indexer([np.nan])
        expected = np.array([2], dtype="int64")
>       tm.assert_numpy_array_equal(result, expected)
E       AssertionError: numpy array are different
E       
E       Attribute "dtype" are different
E       [left]:  int32
E       [right]: int64

Does that make sense?

Still not sure about the to_csv one. We might want to drop that test / issue from the list and merge the rest.

@simonjayhawkins
Copy link
Member

@TomAugspurger the original 2 Windows failures are fixed with the suggestions above (tested locally)

@TomAugspurger
Copy link
Contributor

Sorry, I missed that! Will push that up.

@TomAugspurger TomAugspurger merged commit aab7d7c into pandas-dev:master Dec 31, 2019
@TomAugspurger
Copy link
Contributor

Thanks!

@mroeschke mroeschke deleted the regression_testing branch January 1, 2020 01:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment