def test_with_large_file(self): """Initial smoke test""" print("test with large file") xml_string = get_string("fixtures/large-test-file.xml") root = ET.fromstring(xml_string) for institution in root.iter("INSTITUTION"): for course in institution.findall("KISCOURSE"): raw_course_data = xmltodict.parse(ET.tostring(course))[ "KISCOURSE" ] job_list = JobList() job_list.get_stats(raw_course_data)
class TestGetStats(unittest.TestCase): def setUp(self): self.job_list = JobList() def test_with_large_file(self): """Initial smoke test""" print("test with large file") xml_string = get_string("fixtures/large-test-file.xml") root = ET.fromstring(xml_string) for institution in root.iter("INSTITUTION"): for course in institution.findall("KISCOURSE"): raw_course_data = xmltodict.parse(ET.tostring(course))[ "KISCOURSE" ] job_list = JobList() job_list.get_stats(raw_course_data) def test_no_subj(self): raw_course_xml = xmltodict.parse( get_string("fixtures/course_no_subj_for_most.xml") )["KISCOURSE"] expected_result = json.loads( get_string("fixtures/course_no_com_subj_resp.json") ) json_obj = self.job_list.get_stats(raw_course_xml) self.assertListEqual(json_obj, expected_result) def test_with_subj(self): raw_course_xml = xmltodict.parse( get_string("fixtures/course_with_subj_for_most.xml") )["KISCOURSE"] json_obj = self.job_list.get_stats(raw_course_xml) expected_result = json.loads( get_string("fixtures/job_list_with_subj.json") ) self.assertListEqual(json_obj, expected_result) def test_three_commons(self): raw_course_xml = xmltodict.parse( get_string("fixtures/course_three_commons.xml") )["KISCOURSE"] json_obj = self.job_list.get_stats(raw_course_xml) expected_result = json.loads( get_string("fixtures/course_three_commons.json") ) self.assertListEqual(json_obj, expected_result)
def setUp(self): self.job_list = JobList()
def setUp(self): self.job_list = JobList() self.lookup = self.job_list.data_fields_lookup