Beispiel #1
0
def test_add_rows_by_count_noop(df, count, alloc_id, constraint):
    amount = 0

    result = syn._add_rows_by_count(df, amount, count, alloc_id, constraint)

    assert result[count].sum() == df[count].sum()
    pdt.assert_frame_equal(result, df)
Beispiel #2
0
def test_add_rows_by_count_noop(df, count, alloc_id, constraint):
    amount = 0

    result = syn._add_rows_by_count(df, amount, count, alloc_id, constraint)

    assert result[count].sum() == df[count].sum()
    pdt.assert_frame_equal(result, df)
Beispiel #3
0
def test_add_rows_by_count(df, count, alloc_id, constraint):
    amount = 8

    result = syn._add_rows_by_count(df, amount, count, alloc_id, constraint)

    assert result[count].sum() == df[count].sum() + amount
    pdt.assert_frame_equal(
        result,
        pd.DataFrame(
            {alloc_id: ['a', 'b', 'c', 'b', 'c', 'b', 'c'],
             count: [1, 2, 3, 4, 5, 5, 3]}))
Beispiel #4
0
def test_add_rows_by_count(df, count, alloc_id, constraint):
    amount = 8

    result = syn._add_rows_by_count(df, amount, count, alloc_id, constraint)

    assert result[count].sum() == df[count].sum() + amount
    pdt.assert_frame_equal(
        result,
        pd.DataFrame({
            alloc_id: ['a', 'b', 'c', 'b', 'c', 'b', 'c'],
            count: [1, 2, 3, 4, 5, 5, 3]
        }))
Beispiel #5
0
def test_add_rows_by_count_no_stuff(df, count, alloc_id, constraint):
    amount = 18
    stuff = False

    result = syn._add_rows_by_count(
        df, amount, count, alloc_id, constraint, stuff=stuff)

    assert result[count].sum() == df[count].sum() + amount
    pdt.assert_frame_equal(
        result,
        pd.DataFrame(
            {alloc_id: [
                'a', 'b', 'c', 'b', 'c', 'b', 'c', 'c', 'c', None, None],
             count: [1, 2, 3, 4, 5, 5, 4, 3, 2, 1, 3]}))
Beispiel #6
0
def test_add_rows_by_count_no_stuff(df, count, alloc_id, constraint):
    amount = 18
    stuff = False

    result = syn._add_rows_by_count(df,
                                    amount,
                                    count,
                                    alloc_id,
                                    constraint,
                                    stuff=stuff)

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