From f6f6ec0f477620813bab7e5a17d92c95632a7271 Mon Sep 17 00:00:00 2001 From: apalala Date: Mon, 18 Mar 2024 16:13:31 -0400 Subject: [PATCH] [test] add unit test to check that keywords are str --- test/grammar/keyword_test.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/test/grammar/keyword_test.py b/test/grammar/keyword_test.py index 115160d3..a5111955 100644 --- a/test/grammar/keyword_test.py +++ b/test/grammar/keyword_test.py @@ -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)