mirror of
https://github.com/django/django.git
synced 2024-12-22 17:16:24 +00:00
Removed redundant assertions in fixtures tests.
This commit is contained in:
parent
d4c5ef3ebb
commit
49ae7ce50a
5
tests/fixtures/tests.py
vendored
5
tests/fixtures/tests.py
vendored
@ -33,7 +33,6 @@ class TestCaseFixtureLoadingTests(TestCase):
|
|||||||
|
|
||||||
def test_class_fixtures(self):
|
def test_class_fixtures(self):
|
||||||
"Test case has installed 3 fixture objects"
|
"Test case has installed 3 fixture objects"
|
||||||
self.assertEqual(Article.objects.count(), 3)
|
|
||||||
self.assertQuerysetEqual(Article.objects.all(), [
|
self.assertQuerysetEqual(Article.objects.all(), [
|
||||||
'<Article: Django conquers world!>',
|
'<Article: Django conquers world!>',
|
||||||
'<Article: Copyright is fine the way it is>',
|
'<Article: Copyright is fine the way it is>',
|
||||||
@ -721,7 +720,6 @@ class FixtureLoadingTests(DumpDataAssertMixin, TestCase):
|
|||||||
|
|
||||||
with mock.patch('django.core.management.commands.loaddata.sys.stdin', open(fixture_json)):
|
with mock.patch('django.core.management.commands.loaddata.sys.stdin', open(fixture_json)):
|
||||||
management.call_command('loaddata', '--format=json', '-', verbosity=0)
|
management.call_command('loaddata', '--format=json', '-', verbosity=0)
|
||||||
self.assertEqual(Article.objects.count(), 2)
|
|
||||||
self.assertQuerysetEqual(Article.objects.all(), [
|
self.assertQuerysetEqual(Article.objects.all(), [
|
||||||
'<Article: Time to reform copyright>',
|
'<Article: Time to reform copyright>',
|
||||||
'<Article: Poker has no place on ESPN>',
|
'<Article: Poker has no place on ESPN>',
|
||||||
@ -729,7 +727,6 @@ class FixtureLoadingTests(DumpDataAssertMixin, TestCase):
|
|||||||
|
|
||||||
with mock.patch('django.core.management.commands.loaddata.sys.stdin', open(fixture_xml)):
|
with mock.patch('django.core.management.commands.loaddata.sys.stdin', open(fixture_xml)):
|
||||||
management.call_command('loaddata', '--format=xml', '-', verbosity=0)
|
management.call_command('loaddata', '--format=xml', '-', verbosity=0)
|
||||||
self.assertEqual(Article.objects.count(), 3)
|
|
||||||
self.assertQuerysetEqual(Article.objects.all(), [
|
self.assertQuerysetEqual(Article.objects.all(), [
|
||||||
'<Article: XML identified as leading cause of cancer>',
|
'<Article: XML identified as leading cause of cancer>',
|
||||||
'<Article: Time to reform copyright>',
|
'<Article: Time to reform copyright>',
|
||||||
@ -810,7 +807,6 @@ class FixtureTransactionTests(DumpDataAssertMixin, TransactionTestCase):
|
|||||||
class ForwardReferenceTests(DumpDataAssertMixin, TestCase):
|
class ForwardReferenceTests(DumpDataAssertMixin, TestCase):
|
||||||
def test_forward_reference_fk(self):
|
def test_forward_reference_fk(self):
|
||||||
management.call_command('loaddata', 'forward_reference_fk.json', verbosity=0)
|
management.call_command('loaddata', 'forward_reference_fk.json', verbosity=0)
|
||||||
self.assertEqual(NaturalKeyThing.objects.count(), 2)
|
|
||||||
t1, t2 = NaturalKeyThing.objects.all()
|
t1, t2 = NaturalKeyThing.objects.all()
|
||||||
self.assertEqual(t1.other_thing, t2)
|
self.assertEqual(t1.other_thing, t2)
|
||||||
self.assertEqual(t2.other_thing, t1)
|
self.assertEqual(t2.other_thing, t1)
|
||||||
@ -828,7 +824,6 @@ class ForwardReferenceTests(DumpDataAssertMixin, TestCase):
|
|||||||
'forward_reference_fk_natural_key.json',
|
'forward_reference_fk_natural_key.json',
|
||||||
verbosity=0,
|
verbosity=0,
|
||||||
)
|
)
|
||||||
self.assertEqual(NaturalKeyThing.objects.count(), 2)
|
|
||||||
t1, t2 = NaturalKeyThing.objects.all()
|
t1, t2 = NaturalKeyThing.objects.all()
|
||||||
self.assertEqual(t1.other_thing, t2)
|
self.assertEqual(t1.other_thing, t2)
|
||||||
self.assertEqual(t2.other_thing, t1)
|
self.assertEqual(t2.other_thing, t1)
|
||||||
|
@ -10,7 +10,6 @@ class SampleTestCase(TestCase):
|
|||||||
|
|
||||||
def test_class_fixtures(self):
|
def test_class_fixtures(self):
|
||||||
"Test cases can load fixture objects into models defined in packages"
|
"Test cases can load fixture objects into models defined in packages"
|
||||||
self.assertEqual(Article.objects.count(), 3)
|
|
||||||
self.assertQuerysetEqual(
|
self.assertQuerysetEqual(
|
||||||
Article.objects.all(), [
|
Article.objects.all(), [
|
||||||
"Django conquers world!",
|
"Django conquers world!",
|
||||||
|
Loading…
Reference in New Issue
Block a user