5a7514ccb18a3a506d453dd048c665c33835ee56,pandas/tests/indexes/categorical/test_indexing.py,TestGetIndexer,test_get_indexer_non_unique,#TestGetIndexer#,207

Before Change


        ci = CategoricalIndex(list("aabbca"), categories=list("cab"), ordered=False)
        oidx = Index(np.array(ci))

        for n in [1, 2, 5, len(ci)]:
            finder = oidx[np.random.randint(0, len(ci), size=n)]
            expected = oidx.get_indexer_non_unique(finder)[0]

            actual = ci.get_indexer(finder)
            tm.assert_numpy_array_equal(expected, actual)

        // see gh-17323
        //
        // Even when indexer is equal to the
        // members in the index, we should
        // respect duplicates instead of taking
        // the fast-track path.
        for finder in [list("aabbca"), list("aababca")]:
            expected = oidx.get_indexer_non_unique(finder)[0]

            actual = ci.get_indexer(finder)

After Change



        for indexer in [idx2, list("abf"), Index(list("abf"))]:
            msg = "Reindexing only valid with uniquely valued Index objects"
            with pytest.raises(InvalidIndexError, match=msg):
                idx1.get_indexer(idx2)

            r1, _ = idx1.get_indexer_non_unique(idx2)
            expected = np.array([0, 1, 2, -1], dtype=np.intp)
            tm.assert_almost_equal(r1, expected)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 5

Instances


Project Name: pandas-dev/pandas
Commit Name: 5a7514ccb18a3a506d453dd048c665c33835ee56
Time: 2020-12-11
Author: jbrockmendel@gmail.com
File Name: pandas/tests/indexes/categorical/test_indexing.py
Class Name: TestGetIndexer
Method Name: test_get_indexer_non_unique


Project Name: keras-team/keras
Commit Name: 6fb506979a4074e3b935ce22999311c22f6dce6a
Time: 2018-09-28
Author: ybliang8@gmail.com
File Name: tests/keras/layers/advanced_activations_test.py
Class Name:
Method Name: test_relu


Project Name: pantsbuild/pants
Commit Name: fcbcb3c73892ee31df710fcd6b48d06a3efdc143
Time: 2020-04-06
Author: 14852634+Eric-Arellano@users.noreply.github.com
File Name: src/python/pants/engine/target_test.py
Class Name:
Method Name: test_string_sequence_field