def test_get_capabilities(self): """ Check Get Capabilities """ Repository = CTSCapitainsLocalResolver( ["./tests/testing_data/farsiLit"] ) self.assertEqual( len(Repository.__getTextMetadata__()[0]), 4, "General no filter works" ) self.assertEqual( len(Repository.__getTextMetadata__(category="edition")[0]), 2, "Type filter works" ) self.assertEqual( len(Repository.__getTextMetadata__(lang="ger")[0]), 1, "Filtering on language works" ) self.assertEqual( len(Repository.__getTextMetadata__(category="edition", lang="ger")[0]), 0, "Type filter + lang works" ) self.assertEqual( len(Repository.__getTextMetadata__(category="translation", lang="ger")[0]), 1, "Type filter + lang works" ) self.assertEqual( len(Repository.__getTextMetadata__(page=1, limit=2, pagination=True)[0]), 2, "Pagination works without other filters" ) self.assertEqual( len(Repository.__getTextMetadata__(page=2, limit=2, pagination=True)[0]), 2, "Pagination works without other filters at list end" ) self.assertEqual( len(Repository.__getTextMetadata__(urn="urn:cts:farsiLit")[0]), 3, "URN Filtering works" ) self.assertEqual( len(Repository.__getTextMetadata__(urn="urn:cts:latinLit")[0]), 1, "URN Filtering works" ) self.assertEqual( len(Repository.__getTextMetadata__(urn="urn:cts:farsiLit:hafez.divan.perseus-eng1")[0]), 1, "Complete URN filtering works" )
def test_get_capabilities_nocites(self): """ Check Get Capabilities latinLit data""" Repository = CTSCapitainsLocalResolver( ["./tests/testing_data/latinLit"] ) self.assertEqual( len(Repository.__getTextMetadata__(urn="urn:cts:latinLit:stoa0045.stoa008.perseus-lat2")[0]), 0, "Texts without citations were ignored" )