mirror of
https://github.com/getpelican/pelican.git
synced 2025-10-15 20:28:56 +02:00
improve URLWrapper comparison
* speed up via reduced slugify calls (only call when needed) * fix __repr__ to not contain str, should call repr on name * add test_urlwrappers and move URLWrappers tests there * add new equality test * cleanup header additionally: * Content is now decorated with python_2_unicode_compatible instead of treating __str__ differently * better formatting for test_article_metadata_key_lowercase to actually output the conflict instead of a non descriptive error
This commit is contained in:
parent
3f69a1fb62
commit
5389543a39
5 changed files with 80 additions and 48 deletions
|
|
@ -29,12 +29,10 @@ class ReaderTest(unittest.TestCase):
|
|||
self.assertEqual(
|
||||
value,
|
||||
real_value,
|
||||
str('Expected %r to have value %r, but was %r')
|
||||
% (key, value, real_value))
|
||||
'Expected %s to have value %s, but was %s' % (key, value, real_value))
|
||||
else:
|
||||
self.fail(
|
||||
str('Expected %r to have value %r, but was not in Dict')
|
||||
% (key, value))
|
||||
'Expected %s to have value %s, but was not in Dict' % (key, value))
|
||||
|
||||
class TestAssertDictHasSubset(ReaderTest):
|
||||
def setUp(self):
|
||||
|
|
@ -566,9 +564,12 @@ class HTMLReaderTest(ReaderTest):
|
|||
def test_article_metadata_key_lowercase(self):
|
||||
# Keys of metadata should be lowercase.
|
||||
page = self.read_file(path='article_with_uppercase_metadata.html')
|
||||
|
||||
# Key should be lowercase
|
||||
self.assertIn('category', page.metadata, 'Key should be lowercase.')
|
||||
self.assertEqual('Yeah', page.metadata.get('category'),
|
||||
'Value keeps cases.')
|
||||
|
||||
# Value should keep cases
|
||||
self.assertEqual('Yeah', page.metadata.get('category'))
|
||||
|
||||
def test_article_with_nonconformant_meta_tags(self):
|
||||
page = self.read_file(path='article_with_nonconformant_meta_tags.html')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue