gvwilson / sdxpy

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

Fixes CH4 test missed match call #241

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"))