gvwilson / sdxpy

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

Previous tests missed match-call #237

Closed marcchehab closed 1 year ago

marcchehab commented 1 year ago

These two tests produce fail even later in the chapter when the class Either is corrected, principally because they miss a .match("ac") and a .match("ax"), respectively.

def test_either_followed_by_literal_match():
    # /{a,b}c/ matches "ac"
    assert Either(Lit("a"), Lit("b"), Lit("c"))

def test_either_followed_by_literal_no_match():
    # /{a,b}c/ doesn't match "ax"
    assert not Either(Lit("a"), Lit("b"), Lit("x"))
marcchehab commented 1 year ago

I'd have a suggestion for the svg after refactoring, but I'll have to look into how you generated them.

The book is a great resource, thanks a lot for your effort!

gvwilson commented 1 year ago

Thanks @marcchehab - I used https://app.diagrams.net/ to create the diagrams. Can you please email me (gvwilson@third-bit.com) to let me know your name so that I can add you to the acknowledgments?

marcchehab commented 1 year ago

I'm so sorry about the mess in this PR. I didn't realise new commits are always added, so I'll create two clean, new PR from different branches.