def test_teaser_text(): url = "https://www.phineo.org/projekte/details/das-freiwillige-soziale-jahr-in-der-kultur?tx_phineoprojectslite_pi1%5Bpointer%5D=2&tx_phineoprojectslite_pi1%5Bpps%5D=10" catalog = Catalog() res = catalog.teaser_text(url) print(res) assert res == "http://www.bkj.de"
def test_get_extractors(): catalog = Catalog() res = catalog.get_metadata_extractors() assert len(res) == 7
def test_count_details_pages(): url = "https://www.phineo.org/projekte?tx_phineoprojectslite_pi1%5Bpointer%5D=2&tx_phineoprojectslite_pi1%5Bpps%5D=10" parser = Catalog() res = parser.count_projects(url) assert len(res) == 11
def test_count_details_pages(): catalog = Catalog() res = catalog.build() assert res == 250 # lost one, .. did not find the bug...but close enough...
def test_auf_einen_blick(): url = "https://www.phineo.org/projekte/details/jung-alt-begegnung-von-kindern-und-alten-menschen?tx_phineoprojectslite_pi1%5Bpointer%5D=5&tx_phineoprojectslite_pi1%5Bpps%5D=25" parser = Catalog() res = parser.mission(url) assert "Menschen" == res[0:8]
def test_wirk_image(): url = "https://www.phineo.org/projekte/details/dialog-demenz-im-pfaffenwinkel-demenzfreundliche-kommune" parser = Catalog() res = parser.rating(url) assert ".jpg" == res[-4:]
def themen(): url = "https://www.phineo.org/projekte/details/jung-alt-begegnung-von-kindern-und-alten-menschen?tx_phineoprojectslite_pi1%5Bpointer%5D=5&tx_phineoprojectslite_pi1%5Bpps%5D=25" parser = Catalog() res = parser.category(url) assert "Gesundheit & Pflege" == res
def test_reichweite(): url = "https://www.phineo.org/projekte/details/jung-alt-begegnung-von-kindern-und-alten-menschen?tx_phineoprojectslite_pi1%5Bpointer%5D=5&tx_phineoprojectslite_pi1%5Bpps%5D=25" parser = Catalog() res = parser.geo_reach(url) assert "regional" == res
def test_standort(): url = "https://www.phineo.org/projekte/details/jung-alt-begegnung-von-kindern-und-alten-menschen?tx_phineoprojectslite_pi1%5Bpointer%5D=5&tx_phineoprojectslite_pi1%5Bpps%5D=25" parser = Catalog() res = parser.location(url) assert "Niedersachsen" == res
def test_zielgruppe(): url = "https://www.phineo.org/projekte/details/jung-alt-begegnung-von-kindern-und-alten-menschen?tx_phineoprojectslite_pi1%5Bpointer%5D=5&tx_phineoprojectslite_pi1%5Bpps%5D=25" parser = Catalog() res = parser.target_group(url) assert "Kinder & Jugendliche" == res[0]
""" Extracts text from the Phino web site to create an MVP catalog. The catalog is in json formatted """ import jsonlines from selector.phineo.catalog import Catalog import logging import json if __name__ == "__main__": catalog = Catalog(log_level=logging.INFO) cat = catalog.build() filename = '/Users/stewarta/repos/css/data/phineo.json' with open(filename, 'w') as f: f.write(json.dumps(cat))