Made the validation tests python3 friendly.
This commit is contained in:
parent
ea1e8b38b3
commit
814fde32d9
|
@ -79,7 +79,7 @@ class ModelFormsTests(TestCase):
|
||||||
'pub_date': '2010-1-10 14:49:00'
|
'pub_date': '2010-1-10 14:49:00'
|
||||||
}
|
}
|
||||||
form = ArticleForm(data)
|
form = ArticleForm(data)
|
||||||
self.assertEqual(form.errors.keys(), [])
|
self.assertEqual(list(form.errors), [])
|
||||||
article = form.save(commit=False)
|
article = form.save(commit=False)
|
||||||
article.author = self.author
|
article.author = self.author
|
||||||
article.save()
|
article.save()
|
||||||
|
@ -95,7 +95,7 @@ class ModelFormsTests(TestCase):
|
||||||
}
|
}
|
||||||
article = Article(author_id=self.author.id)
|
article = Article(author_id=self.author.id)
|
||||||
form = ArticleForm(data, instance=article)
|
form = ArticleForm(data, instance=article)
|
||||||
self.assertEqual(form.errors.keys(), [])
|
self.assertEqual(list(form.errors), [])
|
||||||
self.assertNotEqual(form.instance.pub_date, None)
|
self.assertNotEqual(form.instance.pub_date, None)
|
||||||
article = form.save()
|
article = form.save()
|
||||||
|
|
||||||
|
@ -108,7 +108,7 @@ class ModelFormsTests(TestCase):
|
||||||
}
|
}
|
||||||
article = Article(author_id=self.author.id)
|
article = Article(author_id=self.author.id)
|
||||||
form = ArticleForm(data, instance=article)
|
form = ArticleForm(data, instance=article)
|
||||||
self.assertEqual(form.errors.keys(), ['pub_date'])
|
self.assertEqual(list(form.errors), ['pub_date'])
|
||||||
|
|
||||||
|
|
||||||
class GenericIPAddressFieldTests(ValidationTestCase):
|
class GenericIPAddressFieldTests(ValidationTestCase):
|
||||||
|
|
Loading…
Reference in New Issue