Skip to content

Commit 0b846a0

Browse files
committed
TEST: Check manual concat of two rx patterns
Works! Just need to tag an explicit newline betwen them. Closes #21. Also add Win helper for running flake8, to show the offending lines of source.
1 parent 60a6b13 commit 0b846a0

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

flake.bat

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
@echo off
2+
3+
flake8 --show-source pent

pent/test/pent_base.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ def test_string_and_single_num_capture(self):
269269
self.assertEqual(m.group(pent.group_prefix + "2"), v)
270270

271271
def number_ending_sentence(self):
272-
"""Check that a number at the end of a sentence is matched correctly."""
272+
"""Check that a number at the end of a sentence matches correctly."""
273273
import pent
274274

275275
from .testdata import number_patterns as npats
@@ -322,6 +322,20 @@ def test_any_token_capture_ranges(self):
322322
self.assertEqual(m.group(pent.group_prefix + "2"), test_num)
323323
self.assertEqual(m.group(pent.group_prefix + "3"), test_line_end)
324324

325+
def test_manual_two_lines(self):
326+
"""Run manual check on concatenating two single-line regexes."""
327+
test_str = "This is line one: 12345 \nAnd this is line two: -3e-5"
328+
329+
test_pat_1 = "~! @!.one: #!.+i"
330+
test_pat_2 = "~! @!.two: #!.-s"
331+
332+
cp_1 = self.prs.convert_line(test_pat_1)
333+
cp_2 = self.prs.convert_line(test_pat_2)
334+
335+
m = re.search(cp_1 + r"\n" + cp_2, test_str)
336+
337+
self.assertIsNotNone(m)
338+
325339

326340
class TestPentTokens(ut.TestCase, SuperPent):
327341
"""Direct tests on the Token class."""

0 commit comments

Comments
 (0)