Source for: test_justify_row.py [raw]

 1import boxes
 2
 3
 4def test_justify_simple():
 5    """Test a simple use case."""
 6    # First setup what we will use, our "test case"
 7    row = [boxes.Box(x=i, w=1, h=1, letter="a") for i in range(10)]
 8    page = boxes.Box(w=50, h=50)
 9    separation = .1
10
11    # Check expected characteristics
12    assert len(row) == 10
13    assert row[-1].x + row[-1].w == 10
14
15    # Do the thing
16    boxes.justify_row(row, page, separation)
17
18    # Check the expected behavior
19
20    # Should have the same number of elements
21    assert len(row) == 10
22    # The first element should be flushed-left
23    assert row[0].x == page.x
24    # The last element should be flushed-right
25    assert row[-1].x + row[-1].w == page.x + page.w
26