diff options
| author | Tim Graham <timograham@gmail.com> | 2016-09-15 12:12:26 -0400 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2016-09-16 10:29:02 -0400 |
| commit | 49412f55a5de7c3fa773e8a911439beb1568b901 (patch) | |
| tree | 7e7974eb0de5ebd0ba382e5439b26c00ee29c020 | |
| parent | 16202863facc8629a7422cf74cd3df30142d3aaf (diff) | |
Refs #27025 -- Fixed a test for the new re.RegexFlag in Python 3.6.
http://bugs.python.org/issue28082
| -rw-r--r-- | tests/migrations/test_writer.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/tests/migrations/test_writer.py b/tests/migrations/test_writer.py index 8febf40f03..ad77b51ae7 100644 --- a/tests/migrations/test_writer.py +++ b/tests/migrations/test_writer.py @@ -7,6 +7,7 @@ import functools import math import os import re +import sys import tokenize import unittest @@ -35,6 +36,8 @@ try: except ImportError: enum = None +PY36 = sys.version_info >= (3, 6) + class Money(decimal.Decimal): def deconstruct(self): @@ -412,7 +415,10 @@ class WriterTests(SimpleTestCase): # Test a string regex with flag validator = RegexValidator(r'^[0-9]+$', flags=re.U) string = MigrationWriter.serialize(validator)[0] - self.assertEqual(string, "django.core.validators.RegexValidator('^[0-9]+$', flags=32)") + if PY36: + self.assertEqual(string, "django.core.validators.RegexValidator('^[0-9]+$', flags=re.RegexFlag(32))") + else: + self.assertEqual(string, "django.core.validators.RegexValidator('^[0-9]+$', flags=32)") self.serialize_round_trip(validator) # Test message and code |
