Beispiel #1
0
def verify_result(sut, f, width, height, values):
    f.seek(0)
    actual = Layout.load_from_file(f)

    # Verify the state of the object under test
    assert sut.width == width
    assert sut.height == height
    assert sut.values == values

    # Also verify the backing file to ensure coherence
    assert actual.width == width
    assert actual.height == height
    assert actual.values == values
Beispiel #2
0
def test_create_from_file_wide():
    s = '2|1\n---|RED'
    f = create_pseudo_file(s)
    sut = Layout.load_from_file(f)

    verify_result(sut, f, 2, 1, [[None, 'RED']])
Beispiel #3
0
def test_create_from_file_tall():
    s = '1|2\n---\nRED'
    f = create_pseudo_file(s)
    sut = Layout.load_from_file(f)

    verify_result(sut, f, 1, 2, [[None], ['RED']])
Beispiel #4
0
def test_create_from_file_not_none():
    s = '1|1\nRED'
    f = create_pseudo_file(s)
    sut = Layout.load_from_file(f)

    verify_result(sut, f, 1, 1, [['RED']])