From 6a8d4155f64292526d3a3cd4d0345ba3a10794b1 Mon Sep 17 00:00:00 2001 From: Charles Cooper Date: Fri, 26 Jul 2024 19:26:08 +0800 Subject: [PATCH] fix[test]: fix test in grammar fuzzer (#4150) hypothesis `6.103.1` generates examples like ``` Falsifying example: test_grammar_bruteforce( code='"""\r""" \n""""""', ) ``` which trivially raise an exception in asttokens. filter out `\r` characters when generating source codes. --- tests/functional/grammar/test_grammar.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/functional/grammar/test_grammar.py b/tests/functional/grammar/test_grammar.py index c1d2e1d6e6..2af5385b3d 100644 --- a/tests/functional/grammar/test_grammar.py +++ b/tests/functional/grammar/test_grammar.py @@ -39,7 +39,7 @@ def test_basic_grammar_empty(): def fix_terminal(terminal: str) -> str: # these throw exceptions in the grammar - for bad in ("\x00", "\\ ", "\x0c"): + for bad in ("\x00", "\\ ", "\x0c", "\x0d"): terminal = terminal.replace(bad, " ") return terminal