From 803210d287b91c0f8d6895bc2e095bd0d3531f9a Mon Sep 17 00:00:00 2001 From: dirkf Date: Thu, 12 Dec 2024 16:26:57 +0000 Subject: [PATCH] Unicode matching too hard for 3.2? --- test/test_jsinterp.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/test/test_jsinterp.py b/test/test_jsinterp.py index 97367cd67..2eea12045 100644 --- a/test/test_jsinterp.py +++ b/test/test_jsinterp.py @@ -516,11 +516,12 @@ class TestJSInterpreter(unittest.TestCase): ['t', 'e', 's', 't']) self._test('function f(){return "t-e-s-t".split(/[es-]+/)}', ['t', 't']) - # from MDN: surrogate pairs aren't handled: case 1 fails - # self._test('function f(){return "😄😄".split(/(?:)/)}', - # ['\ud83d', '\ude04', '\ud83d', '\ude04']) - self._test('function f(){return "😄😄".split(/(?:)/u)}', - ['😄', '😄']) + # from MDN: surrogate pairs aren't handled: case 1 fails, and case 2 beats Py3.2 + if sys.version_info >= (2, 6) and not ((3, 0) <= sys.version_info <= (3, 2)): + # self._test('function f(){return "😄😄".split(/(?:)/)}', + # ['\ud83d', '\ude04', '\ud83d', '\ude04']) + self._test('function f(){return "😄😄".split(/(?:)/u)}', + ['😄', '😄']) def test_slice(self): self._test('function f(){return [0, 1, 2, 3, 4, 5, 6, 7, 8].slice()}', [0, 1, 2, 3, 4, 5, 6, 7, 8])