-# This file is part of Wolnelektury, licensed under GNU Affero GPLv3 or later.
-# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
+# This file is part of Wolne Lektury, licensed under GNU Affero GPLv3 or later.
+# Copyright © Fundacja Wolne Lektury. See NOTICE for more information.
about="http://wolnelektury.pl/example/URI/default_book",
title="Default Book",
author=PersonStub(("Jim",), "Lazy"),
about="http://wolnelektury.pl/example/URI/default_book",
title="Default Book",
author=PersonStub(("Jim",), "Lazy"),
- self.assertTrue([('theme', 'love')],
- book.fragments.all()[0].tags.filter(category='theme').values_list('category', 'slug'))
+ self.assertEqual(
+ [('theme', 'love')],
+ list(
+ book.fragments.all()[0].tags.filter(
+ category='theme'
+ ).values_list('category', 'slug')
+ )
+ )
def test_book_with_invalid_slug(self):
""" Book with invalid characters in slug shouldn't be imported """
def test_book_with_invalid_slug(self):
""" Book with invalid characters in slug shouldn't be imported """
book_text = "<utwor />"
with self.assertRaises(ValueError):
models.Book.from_text_and_meta(ContentFile(book_text), self.book_info)
book_text = "<utwor />"
with self.assertRaises(ValueError):
models.Book.from_text_and_meta(ContentFile(book_text), self.book_info)
self.book_info.epochs = self.book_info.epoch, 'Y-Epoch',
self.expected_tags.extend([
self.book_info.epochs = self.book_info.epoch, 'Y-Epoch',
self.expected_tags.extend([
- list(self.client.get('/katalog/gatunek/x-genre/').context['object_list']),
- [self.parent],
- "There should be only parent on common tag page."
- )
+ list(self.client.get('/katalog/gatunek/x-genre/').context['object_list']),
+ [self.parent],
+ "There should be only parent on common tag page."
+ )
# pies = models.Tag.objects.get(slug='pies')
themes = self.parent.related_themes()
self.assertEqual(len(themes), 1, "There should be child theme in parent theme counter.")
# pies = models.Tag.objects.get(slug='pies')
themes = self.parent.related_themes()
self.assertEqual(len(themes), 1, "There should be child theme in parent theme counter.")
models.Book.from_text_and_meta(
ContentFile(child_text), self.child_info, overwrite=True)
self.assertEqual(
models.Book.from_text_and_meta(
ContentFile(child_text), self.child_info, overwrite=True)
self.assertEqual(
- list(self.client.get('/katalog/gatunek/x-genre/').context['object_list']),
- [self.parent],
- "There should only be parent on common tag page."
- )
+ list(self.client.get('/katalog/gatunek/x-genre/').context['object_list']),
+ [self.parent],
+ "There should only be parent on common tag page."
+ )
# pies = models.Tag.objects.get(slug='pies')
# kot = models.Tag.objects.get(slug='kot')
self.assertEqual(len(self.parent.related_themes()), 2,
# pies = models.Tag.objects.get(slug='pies')
# kot = models.Tag.objects.get(slug='kot')
self.assertEqual(len(self.parent.related_themes()), 2,