Skip to content

Commit

Permalink
[test] add unit test to check that keywords are str
Browse files Browse the repository at this point in the history
  • Loading branch information
apalala committed Mar 18, 2024
1 parent 82adafd commit f6f6ec0
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions test/grammar/keyword_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,3 +156,14 @@ def test_ignorecase_keywords():

with pytest.raises(FailedParse):
model.parse('IF if 1', trace=False)


def test_keywords_are_str():
grammar = r"""
@@keyword :: True False
start = $ ;
"""
model = compile(grammar, 'test')
assert model.keywords == ['True', 'False']
assert all(isinstance(k, str) for k in model.keywords)

0 comments on commit f6f6ec0

Please sign in to comment.