summaryrefslogtreecommitdiff
path: root/tests/test_simple_unit.py
diff options
context:
space:
mode:
authorKazantcev Andrey <45011689+heckad@users.noreply.github.com>2021-07-30 05:19:24 +0300
committerGitHub <noreply@github.com>2021-07-29 21:19:24 -0500
commit0e1499905f0f067e4f01a5c3133bc0f7c4651b0c (patch)
treedb1ed8feddd7c5a922b46ead95b59d3fcfc9f604 /tests/test_simple_unit.py
parentd108a29db062c9250f50c978e3a86381d1b0746b (diff)
downloadpyparsing-git-0e1499905f0f067e4f01a5c3133bc0f7c4651b0c.tar.gz
Add allowTrailingDelim to delimitedList helper (#285)
Merge pull request #285 - Add allowTrailingDelim to delimitedList helper
Diffstat (limited to 'tests/test_simple_unit.py')
-rw-r--r--tests/test_simple_unit.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/test_simple_unit.py b/tests/test_simple_unit.py
index 8682f0f..52ab5c9 100644
--- a/tests/test_simple_unit.py
+++ b/tests/test_simple_unit.py
@@ -264,6 +264,12 @@ class TestRepetition(PyparsingExpressionTestCase):
expected_list=["xxyx", "xy", "y", "xxyx", "yxx", "xy"],
),
PpTestSpec(
+ desc="Using delimitedList (comma is the default delimiter) with trailing delimiter",
+ expr=pp.delimitedList(pp.Word(pp.alphas), allowTrailingDelim=True),
+ text="xxyx,xy,y,xxyx,yxx, xy,",
+ expected_list=["xxyx", "xy", "y", "xxyx", "yxx", "xy"],
+ ),
+ PpTestSpec(
desc="Using delimitedList, with ':' delimiter",
expr=pp.delimitedList(
pp.Word(pp.hexnums, exact=2), delim=":", combine=True
@@ -271,6 +277,14 @@ class TestRepetition(PyparsingExpressionTestCase):
text="0A:4B:73:21:FE:76",
expected_list=["0A:4B:73:21:FE:76"],
),
+ PpTestSpec(
+ desc="Using delimitedList, with ':' delimiter",
+ expr=pp.delimitedList(
+ pp.Word(pp.hexnums, exact=2), delim=":", combine=True, allowTrailingDelim=True
+ ),
+ text="0A:4B:73:21:FE:76:",
+ expected_list=["0A:4B:73:21:FE:76:"],
+ ),
]