예제 #1
0
def test_get_assert_function_pandas_series():
    try:
        import pandas as pd
        import pandas.util.testing

    except ImportError:
        return

    expected = pd.util.testing.assert_series_equal

    actual = ipytest.get_assert_function(pd.Series(), None)
    ipytest.assert_equals(actual, expected)

    actual = ipytest.get_assert_function(None, pd.Series())
    ipytest.assert_equals(actual, expected)

    actual = ipytest.get_assert_function(pd.Series(), pd.Series())
    ipytest.assert_equals(actual, expected)
예제 #2
0
def test_get_assert_function_pandas_series():
    try:
        import pandas as pd
        import pandas.util.testing
    
    except ImportError:
        return
    
    expected = pd.util.testing.assert_series_equal
    
    actual = ipytest.get_assert_function(pd.Series(), None)
    ipytest.assert_equals(actual, expected)
    
    actual = ipytest.get_assert_function(None, pd.Series())
    ipytest.assert_equals(actual, expected)
    
    actual = ipytest.get_assert_function(pd.Series(), pd.Series())
    ipytest.assert_equals(actual, expected)
예제 #3
0
def test_get_assert_function_pandas_frame():
    try:
        import pandas as pd
        import pandas.util.testing as pdt

    except ImportError:
        return

    expected = pdt.assert_frame_equal

    actual = ipytest.get_assert_function(pd.DataFrame(), None)
    ipytest.assert_equals(actual, expected)

    actual = ipytest.get_assert_function(None, pd.DataFrame())
    ipytest.assert_equals(actual, expected)

    actual = ipytest.get_assert_function(pd.DataFrame(), pd.DataFrame())
    ipytest.assert_equals(actual, expected)
예제 #4
0
def test_get_assert_function_numpy():
    try:
        import numpy as np

    except ImportError:
        return

    actual = ipytest.get_assert_function(np.array(1), None)
    expected = np.testing.assert_allclose

    assert actual == expected

    actual = ipytest.get_assert_function(None, np.array(1))
    expected = np.testing.assert_allclose

    assert actual == expected

    actual = ipytest.get_assert_function(np.array(1), np.array(2))
    expected = np.testing.assert_allclose

    assert actual == expected
예제 #5
0
def test_get_assert_function_numpy():
    try:
        import numpy as np

    except ImportError:
        return
    
    actual = ipytest.get_assert_function(np.array(1), None)
    expected = np.testing.assert_allclose
    
    assert actual == expected
    
    actual = ipytest.get_assert_function(None, np.array(1))
    expected = np.testing.assert_allclose
    
    assert actual == expected
    
    actual = ipytest.get_assert_function(np.array(1), np.array(2))
    expected = np.testing.assert_allclose
    
    assert actual == expected