gvwilson / sdxpy

Software Design by Example: a tool-based introduction with Python
https://third-bit.com/sdxpy/
Other
280 stars 49 forks source link

Chap 14.3 Page Layout #305

Open anonymous12345654321 opened 1 week ago

anonymous12345654321 commented 1 week ago

From the book

def test_renders_a_column_of_two_blocks():
    fixture = Col(Block(1, 1), Block(2, 4))
    fixture.place(0, 0)
    expected = "\n".join(["ba", "cc", "cc", "cc", "cc"])
    assert render(fixture) == expected

Running this, results - for me - in an error, since Col do not have a .place method. I think it should be a PlacedCol(PlacedBlock(1, 1), PlacedBlock(2, 4)).

Also

def test_renders_a_column_of_two_blocks():
    fixture = Col(Block(1, 1), Block(2, 4))
    fixture.place(0, 0)
    expected = "\n".join(["ba", "cc", "cc", "cc", "cc"])
    assert render(fixture) == expected

does not work for me, as no render function is defined.

Either I am doing something wrong or there is a bug (or both).

Anyway, thanks for sharing this great work!