Code

Ticket #11420: patch-11420.diff

File patch-11420.diff, 860 bytes (added by richardb, 5 years ago)
Line 
1Index: regressiontests/model_regress/models.py
2===================================================================
3--- regressiontests/model_regress/models.py     (revision 11174)
4+++ regressiontests/model_regress/models.py     (working copy)
5@@ -1,5 +1,6 @@
6 # coding: utf-8
7 import datetime
8+import sys
9
10 from django.conf import settings
11 from django.db import models
12@@ -141,13 +142,17 @@
13 >>> w
14 <Worker: Full-time>
15
16+"""}
17+
18+if sys.getdefaultencoding() == 'ascii':
19+    __test__["encoding-tests"] = """
20 # Models with broken unicode methods should still have a printable repr
21 >>> b = BrokenUnicodeMethod(name="Jerry")
22 >>> b.save()
23 >>> BrokenUnicodeMethod.objects.all()
24 [<BrokenUnicodeMethod: [Bad Unicode data]>]
25
26-"""}
27+"""
28
29 if settings.DATABASE_ENGINE not in ("mysql", "oracle"):
30     __test__["timezone-tests"] = """