test pageId on file w/o mets
from test.base import TestCase, main, assets
from ocrd.constants import MIMETYPE_PAGE, VERSION
-from ocrd.model import OcrdMets
+from ocrd.model import OcrdMets, OcrdFile
# pylint: disable=protected-access,deprecated-method
class TestOcrdMets(TestCase):
@@ -50,6 +50,13 @@ class TestOcrdMets(TestCase):
self.mets.add_file_group('TEST')
self.assertEqual(len(self.mets.file_groups), 18, '18 file groups')
+ def test_no_pageid_without_mets(self):
+ f = OcrdFile(None)
+ with self.assertRaisesRegexp(Exception, ".*has no member mets pointing.*"):
+ print(f.pageId)
+ with self.assertRaisesRegexp(Exception, ".*has no member mets pointing.*"):
+ f.pageId = 'foo'
+
def test_add_file(self):
self.assertEqual(len(self.mets.file_groups), 17, '17 file groups')
self.assertEqual(len(self.mets.find_files(fileGrp='OUTPUT')), 0, '0 files in "OUTPUT"')
