mirror of
https://github.com/django/django.git
synced 2024-12-22 09:05:43 +00:00
Refs #27546 -- Tested some __repr__() methods.
This commit is contained in:
parent
78500102b7
commit
794b7d8033
1
AUTHORS
1
AUTHORS
@ -11,6 +11,7 @@ answer newbie questions, and generally made Django that much better:
|
||||
Adam Johnson <https://github.com/adamchainz>
|
||||
Adam Malinowski <http://adammalinowski.co.uk>
|
||||
Adam Vandenberg
|
||||
Adiyat Mubarak <adiyatmubarak@gmail.com>
|
||||
Adrian Holovaty <adrian@holovaty.com>
|
||||
Adrien Lemaire <lemaire.adrien@gmail.com>
|
||||
Afonso Fernández Nogueira <fonzzo.django@gmail.com>
|
||||
|
13
tests/i18n/test_management.py
Normal file
13
tests/i18n/test_management.py
Normal file
@ -0,0 +1,13 @@
|
||||
import os
|
||||
|
||||
from django.core.management.commands.makemessages import TranslatableFile
|
||||
from django.test import SimpleTestCase
|
||||
|
||||
|
||||
class TranslatableFileTests(SimpleTestCase):
|
||||
|
||||
def test_repr(self):
|
||||
dirpath = 'dir'
|
||||
file_name = 'example'
|
||||
trans_file = TranslatableFile(dirpath=dirpath, file_name=file_name, locale_dir=None)
|
||||
self.assertEqual(repr(trans_file), '<TranslatableFile: %s>' % os.path.join(dirpath, file_name))
|
@ -3,6 +3,7 @@ from __future__ import unicode_literals
|
||||
from datetime import date
|
||||
from decimal import Decimal
|
||||
|
||||
from django.db.models.query import RawQuerySet
|
||||
from django.db.models.query_utils import InvalidQuery
|
||||
from django.test import TestCase, skipUnlessDBFeature
|
||||
|
||||
@ -90,6 +91,11 @@ class RawQueryTests(TestCase):
|
||||
self.assertTrue(hasattr(result, annotation))
|
||||
self.assertEqual(getattr(result, annotation), value)
|
||||
|
||||
def test_rawqueryset_repr(self):
|
||||
queryset = RawQuerySet(raw_query='SELECT * FROM raw_query_author')
|
||||
self.assertEqual(repr(queryset), '<RawQuerySet: SELECT * FROM raw_query_author>')
|
||||
self.assertEqual(repr(queryset.query), '<RawQuery: SELECT * FROM raw_query_author>')
|
||||
|
||||
def test_simple_raw_query(self):
|
||||
"""
|
||||
Basic test of raw query with a simple database query
|
||||
|
12
tests/serializers/test_deserializedobject.py
Normal file
12
tests/serializers/test_deserializedobject.py
Normal file
@ -0,0 +1,12 @@
|
||||
from django.core.serializers.base import DeserializedObject
|
||||
from django.test import SimpleTestCase
|
||||
|
||||
from .models import Author
|
||||
|
||||
|
||||
class TestDeserializedObjectTests(SimpleTestCase):
|
||||
|
||||
def test_repr(self):
|
||||
author = Author(name='John', pk=1)
|
||||
deserial_obj = DeserializedObject(obj=author)
|
||||
self.assertEqual(repr(deserial_obj), '<DeserializedObject: serializers.Author(pk=1)>')
|
@ -45,3 +45,7 @@ class TestBaseConv(TestCase):
|
||||
with self.assertRaises(ValueError):
|
||||
BaseConverter('abc', sign='a')
|
||||
self.assertIsInstance(BaseConverter('abc', sign='d'), BaseConverter)
|
||||
|
||||
def test_repr(self):
|
||||
base7 = BaseConverter('cjdhel3', sign='g')
|
||||
self.assertEqual(repr(base7), '<BaseConverter: base7 (cjdhel3)>')
|
||||
|
Loading…
Reference in New Issue
Block a user