Merge pull request #882 from loic/testfix

Fixed minor warnings in tests.
This commit is contained in:
Ramiro Morales 2013-03-06 16:22:06 -08:00
commit c31a9793c6
2 changed files with 4 additions and 3 deletions

View File

@ -1,7 +1,7 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from __future__ import unicode_literals from __future__ import unicode_literals
from warnings import catch_warnings import warnings
from django.forms import * from django.forms import *
from django.test import TestCase from django.test import TestCase
@ -62,8 +62,9 @@ class FormsRegressionsTestCase(TestCase):
(b'\xd1\x88\xd1\x82.', b'\xd1\x88\xd1\x82.')) (b'\xd1\x88\xd1\x82.', b'\xd1\x88\xd1\x82.'))
f = ChoiceField(choices=UNITS) f = ChoiceField(choices=UNITS)
self.assertEqual(f.clean('\u0448\u0442.'), '\u0448\u0442.') self.assertEqual(f.clean('\u0448\u0442.'), '\u0448\u0442.')
with catch_warnings(record=True): with warnings.catch_warnings():
# Ignore UnicodeWarning # Ignore UnicodeWarning
warnings.simplefilter("ignore")
self.assertEqual(f.clean(b'\xd1\x88\xd1\x82.'), '\u0448\u0442.') self.assertEqual(f.clean(b'\xd1\x88\xd1\x82.'), '\u0448\u0442.')
# Translated error messages used to be buggy. # Translated error messages used to be buggy.

View File

@ -113,7 +113,7 @@ class ModuleImportTestCase(unittest.TestCase):
# Test exceptions raised # Test exceptions raised
for path in ('no_dots_in_path', 'unexistent.path', for path in ('no_dots_in_path', 'unexistent.path',
'tests.utils_tests.unexistent'): 'utils_tests.unexistent'):
self.assertRaises(ImproperlyConfigured, import_by_path, path) self.assertRaises(ImproperlyConfigured, import_by_path, path)
with self.assertRaises(ImproperlyConfigured) as cm: with self.assertRaises(ImproperlyConfigured) as cm: