summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTiziano Müller <dev-zero@gentoo.org>2016-09-09 14:33:01 +0200
committerTiziano Müller <dev-zero@gentoo.org>2016-09-09 14:34:57 +0200
commitd72614043d6f5e2764db783191c4ab4ab91d0888 (patch)
treed4078390a411d8b86ff351e731e6e3d572d52c8a /dev-python/parse/files
parentprofiles/package.mask: mask app-misc/subsurface for removal (diff)
downloadgentoo-d72614043d6f5e2764db783191c4ab4ab91d0888.tar.gz
gentoo-d72614043d6f5e2764db783191c4ab4ab91d0888.tar.bz2
gentoo-d72614043d6f5e2764db783191c4ab4ab91d0888.zip
dev-python/parse: version bump (including EAPI bump and py-3.5 support)
Package-Manager: portage-2.3.0
Diffstat (limited to 'dev-python/parse/files')
-rw-r--r--dev-python/parse/files/parse-1.6.6-python-3.5-tests-compat.patch50
1 files changed, 50 insertions, 0 deletions
diff --git a/dev-python/parse/files/parse-1.6.6-python-3.5-tests-compat.patch b/dev-python/parse/files/parse-1.6.6-python-3.5-tests-compat.patch
new file mode 100644
index 000000000000..5183cf5ef32e
--- /dev/null
+++ b/dev-python/parse/files/parse-1.6.6-python-3.5-tests-compat.patch
@@ -0,0 +1,50 @@
+From 32f15cfefb7c7b6476360ac65cba807aa3dfccfa Mon Sep 17 00:00:00 2001
+From: David King <dking@redhat.com>
+Date: Mon, 14 Dec 2015 09:58:19 +0000
+Subject: [PATCH] Fix test_too_many_fields with Python 3.5
+
+Python versions before 3.5 had a limit of 100 groups in regular
+expressions. This limit was removed during 3.5 development:
+
+http://bugs.python.org/issue22437
+https://hg.python.org/cpython/rev/0b85ea4bd1af
+
+The test_too_many_fields test asserts that the limit exists by
+attempting to parse a string with 15 fields, which triggers the 100
+named groups limit.
+
+Adjust the test so that if first checks to see whether the limit of 100
+named groups exists, and only assert that parsing 15 fields fails if
+that is the case.
+---
+ test_parse.py | 10 ++++++++--
+ 1 file changed, 8 insertions(+), 2 deletions(-)
+
+diff --git a/test_parse.py b/test_parse.py
+index c524349..1d50568 100755
+--- a/test_parse.py
++++ b/test_parse.py
+@@ -6,6 +6,7 @@
+
+ import unittest
+ from datetime import datetime, time
++import re
+
+ import parse
+
+@@ -624,8 +625,13 @@ def test_mixed_type_variant(self):
+ self.assertEqual(r.fixed[21], 'spam')
+
+ def test_too_many_fields(self):
+- p = parse.compile('{:ti}' * 15)
+- self.assertRaises(parse.TooManyFields, p.parse, '')
++ # Python 3.5 removed the limit of 100 named groups in a regular expression,
++ # so only test for the exception if the limit exists.
++ try:
++ re.compile("".join("(?P<n{n}>{n}-)".format(n=i) for i in range(101)))
++ except AssertionError:
++ p = parse.compile('{:ti}' * 15)
++ self.assertRaises(parse.TooManyFields, p.parse, '')
+
+
+ class TestSearch(unittest.TestCase):