mirror of https://github.com/django/django.git
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 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
|
||||
|
|
Loading…
Reference in New Issue