Ticket #17116: 17116.diff

File 17116.diff, 1.1 KB (added by claudep, 3 years ago)

Skip if default encoding is not ascii

  • tests/regressiontests/model_regress/tests.py

    diff --git a/tests/regressiontests/model_regress/tests.py b/tests/regressiontests/model_regress/tests.py
    index 07ad8fa..60aa4da 100644
    a b from __future__ import absolute_import 
    22
    33import datetime
    44from operator import attrgetter
     5import sys
    56
    67from django.core.exceptions import ValidationError
    78from django.test import TestCase, skipUnlessDBFeature
    8 from django.utils import tzinfo
     9from django.utils import tzinfo, unittest
    910
    1011from .models import (Worker, Article, Party, Event, Department,
    1112    BrokenUnicodeMethod, NonAutoPK)
    class ModelTests(TestCase): 
    141142        w = Worker.objects.create(department=d, name="Full-time")
    142143        self.assertEqual(unicode(w), "Full-time")
    143144
     145    @unittest.skipIf(sys.getdefaultencoding() != 'ascii',
     146        "Default system encoding is not ascii")
    144147    def test_broken_unicode(self):
    145148        # Models with broken unicode methods should still have a printable repr
    146149        b = BrokenUnicodeMethod.objects.create(name="Jerry")
Back to Top