コード例 #1
0
ファイル: test_synthesis.py プロジェクト: terratenney/spandex
def test_add_or_remove_rows_noop(seed, df, alloc_id, count, constraint):
    target = len(df)

    result = syn._add_or_remove_rows(df, target, alloc_id, constraint)

    assert len(result) == target
    pdt.assert_frame_equal(result, df)
コード例 #2
0
ファイル: test_synthesis.py プロジェクト: UDST/spandex
def test_add_or_remove_rows_noop(seed, df, alloc_id, count, constraint):
    target = len(df)

    result = syn._add_or_remove_rows(df, target, alloc_id, constraint)

    assert len(result) == target
    pdt.assert_frame_equal(result, df)
コード例 #3
0
ファイル: test_synthesis.py プロジェクト: UDST/spandex
def test_add_or_remove_rows_count_noop(seed, df, alloc_id, count, constraint):
    target = df[count].sum()

    result = syn._add_or_remove_rows(
        df, target, alloc_id, constraint, count=count)

    assert result[count].sum() == target
    pdt.assert_frame_equal(result, df)
コード例 #4
0
ファイル: test_synthesis.py プロジェクト: UDST/spandex
def test_add_or_remove_rows_add(seed, df, alloc_id, count, constraint):
    target = 8

    result = syn._add_or_remove_rows(df, target, alloc_id, constraint)

    assert len(result) == target
    pdt.assert_frame_equal(
        result,
        pd.DataFrame(
            {alloc_id: ['a', 'b', 'c', 'b', 'c', 'b', 'c', 'c'],
             count: [1, 2, 3, 4, 5, 5, 1, 4]}))
コード例 #5
0
ファイル: test_synthesis.py プロジェクト: terratenney/spandex
def test_add_or_remove_rows_count_noop(seed, df, alloc_id, count, constraint):
    target = df[count].sum()

    result = syn._add_or_remove_rows(df,
                                     target,
                                     alloc_id,
                                     constraint,
                                     count=count)

    assert result[count].sum() == target
    pdt.assert_frame_equal(result, df)
コード例 #6
0
ファイル: test_synthesis.py プロジェクト: UDST/spandex
def test_add_or_remove_rows_count_add(seed, df, alloc_id, count, constraint):
    target = 18

    result = syn._add_or_remove_rows(
        df, target, alloc_id, constraint, count=count)

    assert result[count].sum() == target
    pdt.assert_frame_equal(
        result,
        pd.DataFrame(
            {alloc_id: ['a', 'b', 'c', 'b', 'c', 'b'],
             count: [1, 2, 3, 4, 5, 3]}))
コード例 #7
0
ファイル: test_synthesis.py プロジェクト: UDST/spandex
def test_add_or_remove_rows_remove(seed, df, alloc_id, count, constraint):
    target = 3

    result = syn._add_or_remove_rows(df, target, alloc_id, constraint)

    assert len(result) == target
    pdt.assert_frame_equal(
        result,
        pd.DataFrame(
            {alloc_id: ['b', 'c', 'b'],
             count: [2, 3, 4]},
            index=[1, 2, 3]))
コード例 #8
0
ファイル: test_synthesis.py プロジェクト: terratenney/spandex
def test_add_or_remove_rows_add(seed, df, alloc_id, count, constraint):
    target = 8

    result = syn._add_or_remove_rows(df, target, alloc_id, constraint)

    assert len(result) == target
    pdt.assert_frame_equal(
        result,
        pd.DataFrame({
            alloc_id: ['a', 'b', 'c', 'b', 'c', 'b', 'c', 'c'],
            count: [1, 2, 3, 4, 5, 5, 1, 4]
        }))
コード例 #9
0
ファイル: test_synthesis.py プロジェクト: terratenney/spandex
def test_add_or_remove_rows_remove(seed, df, alloc_id, count, constraint):
    target = 3

    result = syn._add_or_remove_rows(df, target, alloc_id, constraint)

    assert len(result) == target
    pdt.assert_frame_equal(
        result,
        pd.DataFrame({
            alloc_id: ['b', 'c', 'b'],
            count: [2, 3, 4]
        },
                     index=[1, 2, 3]))
コード例 #10
0
ファイル: test_synthesis.py プロジェクト: UDST/spandex
def test_add_or_remove_rows_count_add_no_stuff(
        seed, df, alloc_id, count, constraint):
    target = 30
    stuff = False

    result = syn._add_or_remove_rows(
        df, target, alloc_id, constraint, count=count, stuff=stuff)

    assert result[count].sum() == target
    pdt.assert_frame_equal(
        result,
        pd.DataFrame(
            {alloc_id: ['a', 'b', 'c', 'b', 'c', 'b', 'c', 'c', 'c', None],
             count: [1, 2, 3, 4, 5, 5, 4, 3, 2, 1]}))
コード例 #11
0
ファイル: test_synthesis.py プロジェクト: terratenney/spandex
def test_add_or_remove_rows_count_add(seed, df, alloc_id, count, constraint):
    target = 18

    result = syn._add_or_remove_rows(df,
                                     target,
                                     alloc_id,
                                     constraint,
                                     count=count)

    assert result[count].sum() == target
    pdt.assert_frame_equal(
        result,
        pd.DataFrame({
            alloc_id: ['a', 'b', 'c', 'b', 'c', 'b'],
            count: [1, 2, 3, 4, 5, 3]
        }))
コード例 #12
0
ファイル: test_synthesis.py プロジェクト: terratenney/spandex
def test_add_or_remove_rows_count_add_no_stuff(seed, df, alloc_id, count,
                                               constraint):
    target = 30
    stuff = False

    result = syn._add_or_remove_rows(df,
                                     target,
                                     alloc_id,
                                     constraint,
                                     count=count,
                                     stuff=stuff)

    assert result[count].sum() == target
    pdt.assert_frame_equal(
        result,
        pd.DataFrame({
            alloc_id: ['a', 'b', 'c', 'b', 'c', 'b', 'c', 'c', 'c', None],
            count: [1, 2, 3, 4, 5, 5, 4, 3, 2, 1]
        }))