From 96e316b6698dce5cbfd3165dd6e792bc5d72626f Mon Sep 17 00:00:00 2001 From: Luke Plant Date: Thu, 2 May 2024 14:18:27 +0100 Subject: [PATCH] Added test for concat where input stream is bytes This illustrates a flaw with the reverted commits from PR #81 Refs #81 --- tests/test_parsy.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/test_parsy.py b/tests/test_parsy.py index ba08f56..f699508 100644 --- a/tests/test_parsy.py +++ b/tests/test_parsy.py @@ -162,6 +162,12 @@ def test_concat(self): self.assertEqual(parser.parse(""), "") self.assertEqual(parser.parse("abc"), "abc") + def test_concat_from_byte_stream(self): + any_byte = parsy_test_item(lambda c: True, "any byte") + parser = any_byte.map(lambda b: b.decode("ascii")).many().concat() + self.assertEqual(parser.parse(b""), "") + self.assertEqual(parser.parse(b"abc"), "abc") + def test_generate(self): x = y = None