示例#1
0
def test_is_shape():
    shape = 10, 2
    df = pd.DataFrame(np.random.randn(*shape))
    tm.assert_frame_equal(df, ck.is_shape(df, shape))
    result = dc.is_shape(shape=shape)(_add_n)(df)
    tm.assert_frame_equal(result, df + 1)

    with pytest.raises(AssertionError):
        ck.is_shape(df, (9, 2))
    with pytest.raises(AssertionError):
        dc.is_shape((9, 2))(_add_n)(df)
示例#2
0
def test_is_shape():
    shape = 10, 2
    ig_0 = -1, 2
    ig_1 = 10, -1
    ig_2 = None, 2
    ig_3 = 10, None
    shapes = [shape, ig_0, ig_1, ig_2, ig_3]
    df = pd.DataFrame(np.random.randn(*shape))
    for shp in shapes:
        tm.assert_frame_equal(df, ck.is_shape(df, shp))
    for shp in shapes:
        result = dc.is_shape(shape=shp)(_add_n)(df)
        tm.assert_frame_equal(result, df + 1)

    with pytest.raises(AssertionError):
        ck.is_shape(df, (9, 2))
    with pytest.raises(AssertionError):
        dc.is_shape((9, 2))(_add_n)(df)
示例#3
0
def test_is_shape():
    shape = 10, 2
    ig_0 = -1, 2
    ig_1 = 10, -1
    ig_2 = None, 2
    ig_3 = 10, None
    shapes = [shape, ig_0, ig_1, ig_2, ig_3]
    df = pd.DataFrame(np.random.randn(*shape))
    for shp in shapes:
        tm.assert_frame_equal(df, ck.is_shape(df, shp))
    for shp in shapes:
        result = dc.is_shape(shape=shp)(_add_n)(df)
        tm.assert_frame_equal(result, df + 1)

    with pytest.raises(AssertionError):
        ck.is_shape(df, (9, 2))
    with pytest.raises(AssertionError):
        dc.is_shape((9, 2))(_add_n)(df)