From ea46bf36343044a7a61ba3acce4a7f188d986ec5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20S=C3=BAkup?= Date: Mon, 25 Sep 2023 10:31:37 +0200 Subject: [PATCH] Fix regexps and tests for python3.12 --- smartypants.py | 4 ++-- tests/test.py | 4 ++-- tests/test_cli.py | 16 ++++++++-------- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/smartypants.py b/smartypants.py index c39f409..37368fb 100755 --- a/smartypants.py +++ b/smartypants.py @@ -268,13 +268,13 @@ def smartypants(text, attr=None): if do_quotes: if t == "'": # Special case: single-character ' token - if re.match("\S", prev_token_last_char): + if re.match(r"\S", prev_token_last_char): t = "’" else: t = "‘" elif t == '"': # Special case: single-character " token - if re.match("\S", prev_token_last_char): + if re.match(r"\S", prev_token_last_char): t = "”" else: t = "“" diff --git a/tests/test.py b/tests/test.py index 2c1a0ea..ac5075a 100644 --- a/tests/test.py +++ b/tests/test.py @@ -24,7 +24,7 @@ def test_change_default_attr(self): T = sp(TEXT) E = '“foo” -- bar' - self.assertEquals(T, E) + self.assertEqual(T, E) attr = Attr.q | Attr.d Attr.default = attr @@ -32,7 +32,7 @@ def test_change_default_attr(self): T = sp(TEXT) E = '“foo” — bar' - self.assertEquals(T, E) + self.assertEqual(T, E) def test_dates(self): diff --git a/tests/test_cli.py b/tests/test_cli.py index e85545a..6b5e136 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -34,7 +34,7 @@ def test_pipe(self): E = '“foobar”' output = self._p([CLI_SCRIPT], T) - self.assertEquals(output, E) + self.assertEqual(output, E) def test_pipe_attr(self): @@ -42,11 +42,11 @@ def test_pipe_attr(self): E = T output = self._p([CLI_SCRIPT, '--attr', '0'], T) - self.assertEquals(output, E) + self.assertEqual(output, E) E = """"foo" “bar”""" output = self._p([CLI_SCRIPT, '--attr', 'b'], T) - self.assertEquals(output, E) + self.assertEqual(output, E) def test_skipped_elements(self): @@ -54,19 +54,19 @@ def test_skipped_elements(self): E = '“foo” “bar”' output = self._p([CLI_SCRIPT], T) - self.assertEquals(output, E) + self.assertEqual(output, E) E = '"foo" “bar”' output = self._p([CLI_SCRIPT, '--skip', 'a'], T) - self.assertEquals(output, E) + self.assertEqual(output, E) E = '“foo” "bar"' output = self._p([CLI_SCRIPT, '--skip', 'b'], T) - self.assertEquals(output, E) + self.assertEqual(output, E) E = T output = self._p([CLI_SCRIPT, '--skip', 'a,b'], T) - self.assertEquals(output, E) + self.assertEqual(output, E) def test_file(self): @@ -81,4 +81,4 @@ def test_file(self): output = self._p([CLI_SCRIPT, F]) finally: os.remove(F) - self.assertEquals(output, E) + self.assertEqual(output, E)