pytest.mark.xfail - python examples

Here are the examples of the python api pytest.mark.xfail taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

145 Examples 7

3 View Complete Implementation : test_analytics.py
Copyright Apache License 2.0
Author : Frank-qlu
@pytest.mark.xfail(reason='Wrong SparseBlock initialization (GH#17386)')
def test_quantile_multi():
    # GH 17386
    data = [[1, 1], [2, 10], [3, 100], [np.nan, np.nan]]
    q = [0.1, 0.5]

    sparse_df = SparseDataFrame(data)
    result = sparse_df.quantile(q)

    dense_df = DataFrame(data)
    dense_expected = dense_df.quantile(q)
    sparse_expected = SparseDataFrame(dense_expected)

    tm.astert_frame_equal(result, dense_expected)
    tm.astert_sp_frame_equal(result, sparse_expected)

3 View Complete Implementation : test_datetime.py
Copyright Apache License 2.0
Author : Frank-qlu
    @pytest.mark.xfail(reason="different implementation", strict=False)
    def test_direct_arith_with_series_returns_not_implemented(self, data):
        # Right now, we have trouble with this. Returning NotImplemented
        # fails other tests like
        # tests/arithmetic/test_datetime64::TestTimestampSeriesArithmetic::
        # test_dt64_seris_add_intlike
        return super(
            TestArithmeticOps,
            self
        ).test_direct_arith_with_series_returns_not_implemented(data)

3 View Complete Implementation : test_astype.py
Copyright Apache License 2.0
Author : Frank-qlu
    @pytest.mark.xfail(reason='GH#15832')
    def test_subtype_integer_errors(self):
        # float64 -> uint64 fails with negative values
        index = interval_range(-10.0, 10.0)
        dtype = IntervalDtype('uint64')
        with pytest.raises(ValueError):
            index.astype(dtype)

        # float64 -> integer-like fails with non-integer valued floats
        index = interval_range(0.0, 10.0, freq=0.25)
        dtype = IntervalDtype('int64')
        with pytest.raises(ValueError):
            index.astype(dtype)

        dtype = IntervalDtype('uint64')
        with pytest.raises(ValueError):
            index.astype(dtype)

3 View Complete Implementation : test_analytics.py
Copyright Apache License 2.0
Author : Frank-qlu
@pytest.mark.xfail(reason='Wrong SparseBlock initialization (GH#17386)')
def test_quantile():
    # GH 17386
    data = [[1, 1], [2, 10], [3, 100], [np.nan, np.nan]]
    q = 0.1

    sparse_df = SparseDataFrame(data)
    result = sparse_df.quantile(q)

    dense_df = DataFrame(data)
    dense_expected = dense_df.quantile(q)
    sparse_expected = SparseSeries(dense_expected)

    tm.astert_series_equal(result, dense_expected)
    tm.astert_sp_series_equal(result, sparse_expected)

3 View Complete Implementation : test_recfunctions.py
Copyright Apache License 2.0
Author : Frank-qlu
    @pytest.mark.xfail(reason="See comment at gh-9343")
    def test_same_name_different_dtypes_key(self):
        a_dtype = np.dtype([('key', 'S5'), ('value', '<f4')])
        b_dtype = np.dtype([('key', 'S10'), ('value', '<f4')])
        expected_dtype = np.dtype([
            ('key', 'S10'), ('value1', '<f4'), ('value2', '<f4')])

        a = np.array([('Sarah',  8.0), ('John', 6.0)], dtype=a_dtype)
        b = np.array([('Sarah', 10.0), ('John', 7.0)], dtype=b_dtype)
        res = join_by('key', a, b)

        astert_equal(res.dtype, expected_dtype)

3 View Complete Implementation : test_astype.py
Copyright Apache License 2.0
Author : Frank-qlu
    @pytest.mark.xfail(reason='GH#15832')
    def test_subtype_integer_errors(self):
        # float64 -> uint64 fails with negative values
        index = interval_range(-10.0, 10.0)
        dtype = IntervalDtype('uint64')
        with pytest.raises(ValueError):
            index.astype(dtype)

        # float64 -> integer-like fails with non-integer valued floats
        index = interval_range(0.0, 10.0, freq=0.25)
        dtype = IntervalDtype('int64')
        with pytest.raises(ValueError):
            index.astype(dtype)

        dtype = IntervalDtype('uint64')
        with pytest.raises(ValueError):
            index.astype(dtype)

3 View Complete Implementation : test_analytics.py
Copyright Apache License 2.0
Author : Frank-qlu
@pytest.mark.xfail(reason='Wrong SparseBlock initialization (GH#17386)')
def test_quantile():
    # GH 17386
    data = [[1, 1], [2, 10], [3, 100], [np.nan, np.nan]]
    q = 0.1

    sparse_df = SparseDataFrame(data)
    result = sparse_df.quantile(q)

    dense_df = DataFrame(data)
    dense_expected = dense_df.quantile(q)
    sparse_expected = SparseSeries(dense_expected)

    tm.astert_series_equal(result, dense_expected)
    tm.astert_sp_series_equal(result, sparse_expected)

3 View Complete Implementation : test_set_ops.py
Copyright Apache License 2.0
Author : Frank-qlu
@pytest.mark.xfail(reason="Not implemented.")
def test_difference_sort_incomparable_true():
    # TODO decide on True behaviour
    # # sort=True, raises
    idx = pd.MultiIndex.from_product([[1, pd.Timestamp('2000'), 2],
                                      ['a', 'b']])
    other = pd.MultiIndex.from_product([[3, pd.Timestamp('2000'), 4],
                                        ['c', 'd']])

    with pytest.raises(TypeError):
        idx.difference(other, sort=True)

3 View Complete Implementation : test_datetime.py
Copyright Apache License 2.0
Author : Frank-qlu
    @pytest.mark.xfail(reason="different implementation", strict=False)
    def test_direct_arith_with_series_returns_not_implemented(self, data):
        # Right now, we have trouble with this. Returning NotImplemented
        # fails other tests like
        # tests/arithmetic/test_datetime64::TestTimestampSeriesArithmetic::
        # test_dt64_seris_add_intlike
        return super(
            TestArithmeticOps,
            self
        ).test_direct_arith_with_series_returns_not_implemented(data)

3 View Complete Implementation : test_arraypad.py
Copyright Apache License 2.0
Author : Frank-qlu
    @pytest.mark.xfail(exceptions=(astertionError,))
    def test_object_array(self):
        from fractions import Fraction
        arr = np.array([Fraction(1, 2), Fraction(-1, 2)])
        actual = np.pad(arr, (2, 3), mode='linear_ramp', end_values=0)

        # deliberately chosen to have a non-power-of-2 denominator such that
        # rounding to floats causes a failure.
        expected = np.array([
            Fraction( 0, 12),
            Fraction( 3, 12),
            Fraction( 6, 12),
            Fraction(-6, 12),
            Fraction(-4, 12),
            Fraction(-2, 12),
            Fraction(-0, 12),
        ])
        astert_equal(actual, expected)