mirror of
https://github.com/getpelican/pelican.git
synced 2025-10-15 20:28:56 +02:00
tests: Avoid hidden logic with better .assert*() method choices
We'll get better failure messages if we use an assertion method that understands the comparison we're trying to make. If you make the comparison by hand and assertTrue(), you don't get much constructive feedback ;).
This commit is contained in:
parent
1fcf4a6550
commit
5a61600bc9
3 changed files with 6 additions and 6 deletions
|
|
@ -108,7 +108,7 @@ class TestArticlesGenerator(unittest.TestCase):
|
|||
sorted(['Default', 'TestCategory', 'Yeah', 'test', '指導書']),
|
||||
sorted(['Default', 'TestCategory', 'yeah', 'test', '指導書']),
|
||||
)
|
||||
self.assertTrue(sorted(categories) in categories_alternatives)
|
||||
self.assertIn(sorted(categories), categories_alternatives)
|
||||
# test for slug
|
||||
categories = [cat.slug for cat, _ in generator.categories]
|
||||
categories_expected = ['default', 'testcategory', 'yeah', 'test',
|
||||
|
|
@ -136,7 +136,7 @@ class TestArticlesGenerator(unittest.TestCase):
|
|||
sorted(['Default', 'Yeah', 'test', '指導書']),
|
||||
sorted(['Default', 'yeah', 'test', '指導書']),
|
||||
)
|
||||
self.assertTrue(sorted(categories) in categories_alternatives)
|
||||
self.assertIn(sorted(categories), categories_alternatives)
|
||||
# test for slug
|
||||
categories = [cat.slug for cat, _ in generator.categories]
|
||||
categories_expected = ['default', 'yeah', 'test', 'zhi-dao-shu']
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue