diff options
| author | Simon Heisterkamp <simon@heisterkamp.dk> | 2023-01-01 20:59:40 +0000 |
|---|---|---|
| committer | Andi Albrecht <albrecht.andi@gmail.com> | 2023-01-02 08:54:47 +0100 |
| commit | 907fb496f90f2719095a1f01fe24db1e5c0e15a8 (patch) | |
| tree | b2b5c9500519fc53f5e388572f3d06727caf6377 /tests | |
| parent | fbf9a576fe40ad8e4d51bb922bb454c317f73403 (diff) | |
| download | sqlparse-907fb496f90f2719095a1f01fe24db1e5c0e15a8.tar.gz | |
change singleton behavior
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/test_keywords.py | 2 | ||||
| -rw-r--r-- | tests/test_parse.py | 8 |
2 files changed, 5 insertions, 5 deletions
diff --git a/tests/test_keywords.py b/tests/test_keywords.py index 2eddccc..b26e9b4 100644 --- a/tests/test_keywords.py +++ b/tests/test_keywords.py @@ -9,5 +9,5 @@ class TestSQLREGEX: '1.', '-1.', '.1', '-.1']) def test_float_numbers(self, number): - ttype = next(tt for action, tt in Lexer()._SQL_REGEX if action(number)) + ttype = next(tt for action, tt in Lexer.get_default_instance()._SQL_REGEX if action(number)) assert tokens.Number.Float == ttype diff --git a/tests/test_parse.py b/tests/test_parse.py index 33e8541..5feef5a 100644 --- a/tests/test_parse.py +++ b/tests/test_parse.py @@ -509,7 +509,7 @@ def test_configurable_keywords(): (sqlparse.tokens.Punctuation, ";"), ] - Lexer().add_keywords( + Lexer.get_default_instance().add_keywords( { "BACON": sqlparse.tokens.Name.Builtin, "SPAM": sqlparse.tokens.Keyword, @@ -520,7 +520,7 @@ def test_configurable_keywords(): tokens = sqlparse.parse(sql)[0] # reset the syntax for later tests. - Lexer().default_initialization() + Lexer.get_default_instance().default_initialization() assert list( (t.ttype, t.value) @@ -539,7 +539,7 @@ def test_configurable_keywords(): def test_configurable_regex(): - lex = Lexer() + lex = Lexer.get_default_instance() lex.clear() my_regex = (r"ZORDER\s+BY\b", sqlparse.tokens.Keyword) @@ -559,7 +559,7 @@ def test_configurable_regex(): tokens = sqlparse.parse("select * from foo zorder by bar;")[0] # reset the syntax for later tests. - Lexer().default_initialization() + Lexer.get_default_instance().default_initialization() assert list( (t.ttype, t.value) |
