Example #1
0
def test_allocate_rows(df, alloc_id, constraint, count):
    rows = df.loc[[0, 1]]

    syn._allocate_rows(rows, alloc_id, constraint)

    pdt.assert_frame_equal(
        rows,
        pd.DataFrame(
            {alloc_id: ['b', 'c'],
             count: [1, 2]}))
Example #2
0
def test_allocate_rows(df, alloc_id, constraint, count):
    rows = df.loc[[0, 1]]

    syn._allocate_rows(rows, alloc_id, constraint)

    pdt.assert_frame_equal(rows,
                           pd.DataFrame({
                               alloc_id: ['b', 'c'],
                               count: [1, 2]
                           }))
Example #3
0
def test_allocate_rows_no_stuff(df, alloc_id, constraint, count):
    rows = df.copy(deep=True)
    stuff = False

    syn._allocate_rows(rows, alloc_id, constraint, stuff=stuff)

    pdt.assert_frame_equal(
        rows,
        pd.DataFrame(
            {alloc_id: ['b', 'c', 'c', 'c', None],
             count: df[count]}))
Example #4
0
def test_allocate_rows_stuff(df, alloc_id, constraint, count):
    rows = df.copy(deep=True)
    stuff = True

    syn._allocate_rows(rows, alloc_id, constraint, stuff=stuff)

    pdt.assert_frame_equal(
        rows,
        pd.DataFrame({
            alloc_id: ['b', 'c', 'c', 'c', 'a'],
            count: df[count]
        }))