Refs #27025 -- Fixed a test for the new re.RegexFlag in Python 3.6.
http://bugs.python.org/issue28082
This commit is contained in:
parent
16202863fa
commit
49412f55a5
|
@ -7,6 +7,7 @@ import functools
|
||||||
import math
|
import math
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
|
import sys
|
||||||
import tokenize
|
import tokenize
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
|
@ -35,6 +36,8 @@ try:
|
||||||
except ImportError:
|
except ImportError:
|
||||||
enum = None
|
enum = None
|
||||||
|
|
||||||
|
PY36 = sys.version_info >= (3, 6)
|
||||||
|
|
||||||
|
|
||||||
class Money(decimal.Decimal):
|
class Money(decimal.Decimal):
|
||||||
def deconstruct(self):
|
def deconstruct(self):
|
||||||
|
@ -412,6 +415,9 @@ class WriterTests(SimpleTestCase):
|
||||||
# Test a string regex with flag
|
# Test a string regex with flag
|
||||||
validator = RegexValidator(r'^[0-9]+$', flags=re.U)
|
validator = RegexValidator(r'^[0-9]+$', flags=re.U)
|
||||||
string = MigrationWriter.serialize(validator)[0]
|
string = MigrationWriter.serialize(validator)[0]
|
||||||
|
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.assertEqual(string, "django.core.validators.RegexValidator('^[0-9]+$', flags=32)")
|
||||||
self.serialize_round_trip(validator)
|
self.serialize_round_trip(validator)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue