f2ff676169c6f2aca04eebe22e5d31501f8a2a6b,pandas/tests/indexes/datetimes/test_indexing.py,TestWhere,test_where_mismatched_nat,#TestWhere#Any#,203

Before Change


        dti = date_range("2013-01-01", periods=3, tz=tz)
        cond = np.array([True, False, True])

        msg = "value should be a "Timestamp", "NaT", or array of those. Got"
        with pytest.raises(TypeError, match=msg):
            // wrong-dtyped NaT
            dti.where(cond, np.timedelta64("NaT", "ns"))

    def test_where_tz(self):
        i = date_range("20130101", periods=3, tz="US/Eastern")
        result = i.where(notna(i))
        expected = i

After Change



    def test_where_mismatched_nat(self, tz_aware_fixture):
        tz = tz_aware_fixture
        dti = date_range("2013-01-01", periods=3, tz=tz)
        cond = np.array([True, False, True])

        tdnat = np.timedelta64("NaT", "ns")
        expected = Index([dti[0], tdnat, dti[2]], dtype=object)
        assert expected[1] is tdnat

        result = dti.where(cond, tdnat)
        tm.assert_index_equal(result, expected)

    def test_where_tz(self):
        i = date_range("20130101", periods=3, tz="US/Eastern")
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 13

Instances


Project Name: pandas-dev/pandas
Commit Name: f2ff676169c6f2aca04eebe22e5d31501f8a2a6b
Time: 2021-02-10
Author: jbrockmendel@gmail.com
File Name: pandas/tests/indexes/datetimes/test_indexing.py
Class Name: TestWhere
Method Name: test_where_mismatched_nat


Project Name: pandas-dev/pandas
Commit Name: f2ff676169c6f2aca04eebe22e5d31501f8a2a6b
Time: 2021-02-10
Author: jbrockmendel@gmail.com
File Name: pandas/tests/indexing/test_coercion.py
Class Name: TestWhereCoercion
Method Name: test_where_index_timedelta64


Project Name: pandas-dev/pandas
Commit Name: f2ff676169c6f2aca04eebe22e5d31501f8a2a6b
Time: 2021-02-10
Author: jbrockmendel@gmail.com
File Name: pandas/tests/indexes/datetimes/test_indexing.py
Class Name: TestWhere
Method Name: test_where_mismatched_nat


Project Name: pandas-dev/pandas
Commit Name: f2ff676169c6f2aca04eebe22e5d31501f8a2a6b
Time: 2021-02-10
Author: jbrockmendel@gmail.com
File Name: pandas/tests/indexes/period/test_indexing.py
Class Name: TestWhere
Method Name: test_where_mismatched_nat