Skip to content

Flaky ExtensionArray tests #20468

Closed
@TomAugspurger

Description

@TomAugspurger

https://circleci.com/gh/pandas-dev/pandas/12793#tests/containers/3

=================================== FAILURES ===================================
___________________________ TestMethods.test_argsort ___________________________

self = <pandas.tests.extension.json.test_json.TestMethods object at 0x7f1c0e0997f0>
data_for_sorting = JSONArary([{'b': 1}, {'c': 4}, {'c': 3, 'a': 2}])

    @unstable
    def test_argsort(self, data_for_sorting):
>       super(TestMethods, self).test_argsort(data_for_sorting)

pandas/tests/extension/json/test_json.py:98: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
pandas/tests/extension/base/methods.py:38: in test_argsort
    self.assert_series_equal(result, expected)
pandas/util/testing.py:1218: in assert_series_equal
    obj='{obj}'.format(obj=obj))
pandas/_libs/testing.pyx:59: in pandas._libs.testing.assert_almost_equal
    cpdef assert_almost_equal(a, b,
pandas/_libs/testing.pyx:173: in pandas._libs.testing.assert_almost_equal
    raise_assert_detail(obj, msg, lobj, robj)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

obj = 'Series', message = 'Series values are different (66.66667 %)'
left = '[0, 2, 1]', right = '[2, 0, 1]', diff = None

    def raise_assert_detail(obj, message, left, right, diff=None):
        if isinstance(left, np.ndarray):
            left = pprint_thing(left)
        elif is_categorical_dtype(left):
            left = repr(left)
        if isinstance(right, np.ndarray):
            right = pprint_thing(right)
        elif is_categorical_dtype(right):
            right = repr(right)
    
        msg = """{obj} are different
    
    {message}
    [left]:  {left}
    [right]: {right}""".format(obj=obj, message=message, left=left, right=right)
    
        if diff is not None:
            msg += "\n[diff]: {diff}".format(diff=diff)
    
>       raise AssertionError(msg)
E       AssertionError: Series are different
E       
E       Series values are different (66.66667 %)
E       [left]:  [0, 2, 1]
E       [right]: [2, 0, 1]

pandas/util/testing.py:1009: AssertionError
______________________ TestMethods.test_sort_values[True] ______________________

self = <pandas.tests.extension.json.test_json.TestMethods object at 0x7f1c0e0ee2b0>
data_for_sorting = JSONArary([{'b': 1}, {'c': 4}, {'c': 3, 'a': 2}])
ascending = True

    @unstable
    @pytest.mark.parametrize('ascending', [True, False])
    def test_sort_values(self, data_for_sorting, ascending):
        super(TestMethods, self).test_sort_values(
>           data_for_sorting, ascending)

pandas/tests/extension/json/test_json.py:109: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
pandas/tests/extension/base/methods.py:53: in test_sort_values
    self.assert_series_equal(result, expected)
pandas/util/testing.py:1174: in assert_series_equal
    obj='{obj}.index'.format(obj=obj))
pandas/util/testing.py:843: in assert_index_equal
    obj=obj, lobj=left, robj=right)
pandas/_libs/testing.pyx:59: in pandas._libs.testing.assert_almost_equal
    cpdef assert_almost_equal(a, b,
pandas/_libs/testing.pyx:173: in pandas._libs.testing.assert_almost_equal
    raise_assert_detail(obj, msg, lobj, robj)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

obj = 'Series.index', message = 'Series.index values are different (66.66667 %)'
left = Int64Index([0, 2, 1], dtype='int64')
right = Int64Index([2, 0, 1], dtype='int64'), diff = None

    def raise_assert_detail(obj, message, left, right, diff=None):
        if isinstance(left, np.ndarray):
            left = pprint_thing(left)
        elif is_categorical_dtype(left):
            left = repr(left)
        if isinstance(right, np.ndarray):
            right = pprint_thing(right)
        elif is_categorical_dtype(right):
            right = repr(right)
    
        msg = """{obj} are different
    
    {message}
    [left]:  {left}
    [right]: {right}""".format(obj=obj, message=message, left=left, right=right)
    
        if diff is not None:
            msg += "\n[diff]: {diff}".format(diff=diff)
    
>       raise AssertionError(msg)
E       AssertionError: Series.index are different
E       
E       Series.index values are different (66.66667 %)
E       [left]:  Int64Index([0, 2, 1], dtype='int64')
E       [right]: Int64Index([2, 0, 1], dtype='int64')

pandas/util/testing.py:1009: AssertionError
_____________________ TestMethods.test_sort_values[False] ______________________

self = <pandas.tests.extension.json.test_json.TestMethods object at 0x7f1c0d8d3978>
data_for_sorting = JSONArary([{'b': 1}, {'c': 4}, {'c': 3, 'a': 2}])
ascending = False

    @unstable
    @pytest.mark.parametrize('ascending', [True, False])
    def test_sort_values(self, data_for_sorting, ascending):
        super(TestMethods, self).test_sort_values(
>           data_for_sorting, ascending)

pandas/tests/extension/json/test_json.py:109: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
pandas/tests/extension/base/methods.py:53: in test_sort_values
    self.assert_series_equal(result, expected)
pandas/util/testing.py:1174: in assert_series_equal
    obj='{obj}.index'.format(obj=obj))
pandas/util/testing.py:843: in assert_index_equal
    obj=obj, lobj=left, robj=right)
pandas/_libs/testing.pyx:59: in pandas._libs.testing.assert_almost_equal
    cpdef assert_almost_equal(a, b,
pandas/_libs/testing.pyx:173: in pandas._libs.testing.assert_almost_equal
    raise_assert_detail(obj, msg, lobj, robj)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

obj = 'Series.index', message = 'Series.index values are different (66.66667 %)'
left = Int64Index([1, 2, 0], dtype='int64')
right = Int64Index([1, 0, 2], dtype='int64'), diff = None

    def raise_assert_detail(obj, message, left, right, diff=None):
        if isinstance(left, np.ndarray):
            left = pprint_thing(left)
        elif is_categorical_dtype(left):
            left = repr(left)
        if isinstance(right, np.ndarray):
            right = pprint_thing(right)
        elif is_categorical_dtype(right):
            right = repr(right)
    
        msg = """{obj} are different
    
    {message}
    [left]:  {left}
    [right]: {right}""".format(obj=obj, message=message, left=left, right=right)
    
        if diff is not None:
            msg += "\n[diff]: {diff}".format(diff=diff)
    
>       raise AssertionError(msg)
E       AssertionError: Series.index are different
E       
E       Series.index values are different (66.66667 %)
E       [left]:  Int64Index([1, 2, 0], dtype='int64')
E       [right]: Int64Index([1, 0, 2], dtype='int64')

pandas/util/testing.py:1009: AssertionError

Metadata

Metadata

Assignees

No one assigned

    Labels

    CIContinuous IntegrationTestingpandas testing functions or related to the test suiteUnreliable TestUnit tests that occasionally fail

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions