summaryrefslogtreecommitdiff
path: root/tests/invalid_models_tests
diff options
context:
space:
mode:
author薛丞宏 <ihcaoe@gmail.com>2015-06-23 14:08:12 +0800
committerTim Graham <timograham@gmail.com>2015-06-26 08:35:13 -0400
commita97e50c5e6afe0ce2a8fb2ca27c88e57611b0053 (patch)
tree2e9bf0597dd6fef867f87c119a24746a49f4d449 /tests/invalid_models_tests
parentae93aeed2b87c4a6dd9290146aaee5dc57d07bfb (diff)
[1.8.x] Fixed #25016 -- Reallowed non-ASCII values for ForeignKey.related_name on Python 3.
Backport of d3e12c901777697b7bf08b25e2dd46f0b951db8c from master
Diffstat (limited to 'tests/invalid_models_tests')
-rw-r--r--tests/invalid_models_tests/test_relative_fields.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/tests/invalid_models_tests/test_relative_fields.py b/tests/invalid_models_tests/test_relative_fields.py
index b6ac3de722..5d174d0c9b 100644
--- a/tests/invalid_models_tests/test_relative_fields.py
+++ b/tests/invalid_models_tests/test_relative_fields.py
@@ -5,6 +5,7 @@ from django.core.checks import Error, Warning as DjangoWarning
from django.db import models
from django.test.testcases import skipIfDBFeature
from django.test.utils import override_settings
+from django.utils import six
from .base import IsolatedModelsTestCase
@@ -559,9 +560,12 @@ class RelativeFieldTests(IsolatedModelsTestCase):
'contains_%s_whitespace' % whitespace,
'ends_with_with_illegal_non_alphanumeric_%s' % illegal_non_alphanumeric,
'ends_with_whitespace_%s' % whitespace,
- # Python's keyword
- 'with',
+ 'with', # a Python keyword
+ 'related_name\n',
]
+ # Python 2 crashes on non-ASCII strings.
+ if six.PY3:
+ invalid_related_names.append(',')
class Parent(models.Model):
pass
@@ -600,6 +604,9 @@ class RelativeFieldTests(IsolatedModelsTestCase):
'_+',
'+',
]
+ # Python 2 crashes on non-ASCII strings.
+ if six.PY3:
+ related_names.extend(['試', '試驗+'])
class Parent(models.Model):
pass