diff options
author | ptmcg <ptmcg@austin.rr.com> | 2023-04-18 21:25:53 -0500 |
---|---|---|
committer | ptmcg <ptmcg@austin.rr.com> | 2023-04-18 21:25:53 -0500 |
commit | 59623c2cd2de437f0587a003ccab66a1d2adf8be (patch) | |
tree | b30aa27e7983f858a48ecb47ce3614bd19ce37bc /tests | |
parent | cf4f1559503f0eb66343c96cb0144e86f68e9b1d (diff) | |
download | pyparsing-git-59623c2cd2de437f0587a003ccab66a1d2adf8be.tar.gz |
Fix regex matching for Python quoted strings
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_unit.py | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/test_unit.py b/tests/test_unit.py index 76e5826..1f75556 100644 --- a/tests/test_unit.py +++ b/tests/test_unit.py @@ -1321,6 +1321,40 @@ class Test02_WithoutPackrat(ppt.TestParseResultsAsserts, TestCase): print() # fmt: on + def testPythonQuotedStrings(self): + success1, _ = pp.python_quoted_string.run_tests([ + '"""xyz"""', + '''"""xyz + """''', + '"""xyz "" """', + '''"""xyz "" + """''', + '"""xyz " """', + '''"""xyz " + """''', + r'''"""xyz \""" + + """''', + "'''xyz'''", + """'''xyz + '''""", + "'''xyz '' '''", + """'''xyz '' + '''""", + "'''xyz ' '''", + """'''xyz ' + '''""", + r"""'''xyz \''' + '''""", + ]) + + print("\n\nFailure tests") + success2, _ = pp.python_quoted_string.run_tests([ + '"xyz"""', + ], failure_tests=True) + + self.assertTrue(success1 and success2, "Python quoted string matching failure") + def testCaselessOneOf(self): caseless1 = pp.oneOf("d a b c aA B A C", caseless=True) caseless1str = str(caseless1) |