X-Git-Url: https://git.mdrn.pl/librarian.git/blobdiff_plain/05b19dad8ca44136e064abcc6beff5dac4489c60..a3be479506edf42dc58feb22b26e4f5da1e49edd:/tests/test_picture.py diff --git a/tests/test_picture.py b/tests/test_picture.py index 4e3b252..1169f44 100644 --- a/tests/test_picture.py +++ b/tests/test_picture.py @@ -31,10 +31,31 @@ def test_wlpicture(): # from nose.tools import set_trace; set_trace() assert pi.type[0] == u"Image" - assert pi.mime_type == u'image/png' == wlp.mime_type + assert pi.mime_type == u'image/jpeg' == wlp.mime_type assert wlp.slug == 'angelus-novus' assert path.exists(wlp.image_path) f = wlp.image_file('r') f.close() + +def test_picture_parts(): + wlp = picture.WLPicture.from_file(open(get_fixture('picture', 'angelus-novus.xml'))) + parts = list(wlp.partiter()) + expect_parts = 4 + assert len(parts) == expect_parts, "there should be %d parts of the picture" % expect_parts + motifs = set() + names = set() + + print parts + for p in parts: + for m in p['themes']: + motifs.add(m) + for p in parts: + if p['object']: + names.add(p['object']) + + assert motifs == set([u'anioł historii', u'spojrzenie']), "missing motifs, got: %s" % motifs + assert names == set([u'obraz cały', u'skrzydło']), 'missing objects, got: %s' % names + +