1 # -*- coding: utf-8 -*-
2 from __future__ import with_statement
5 from picture.models import Picture
6 from catalogue.test_utils import WLTestCase
9 class PictureTest(WLTestCase):
11 def test_import(self):
12 picture = Picture.from_xml_file(path.join(path.dirname(__file__), "files/kandinsky-composition-viii.xml"))
14 motifs = set([tag.name for tag in picture.tags if tag.category == 'theme'])
15 assert motifs == set([u'nieporządek']), 'theme tags are wrong. %s' % motifs
19 def test_import_with_explicit_image(self):
20 picture = Picture.from_xml_file(path.join(path.dirname(__file__), "files/kandinsky-composition-viii.xml"),
21 path.join(path.dirname(__file__), "files/kandinsky-composition-viii.png"))
26 def test_import_2(self):
27 picture = Picture.from_xml_file(path.join(path.dirname(__file__), "files/pejzaz-i-miasto-krzyzanowski-chmury.xml"),
28 path.join(path.dirname(__file__), "files/pejzaz-i-miasto-krzyzanowski-chmury.jpg"),
30 cats = set([t.category for t in picture.tags])
31 assert 'genre' in cats