def test_json_selector(self): SEL1_DATA = [["Coast", "100"]] SEL2_DATA = [["Plains", "200"]] # make sure legacy selectors still work with make_input(FILE_JSON_SELECTOR, True, selector="sel1") as input: self.assertEqual(SEL1_DATA, hxl.data(input).values) with make_input(FILE_JSON_SELECTOR, True, selector="sel2") as input: self.assertEqual(SEL2_DATA, hxl.data(input).values) # test JSONPath support with make_input(FILE_JSON_SELECTOR, True, selector="$.sel1") as input: self.assertEqual(SEL1_DATA, hxl.data(input).values)
def test_csv_zipped(self): with make_input(FILE_ZIP_CSV, True) as input: self.assertFalse(input.is_repeatable) self.assertTrue('#sector' in hxl.data(input).tags)
def test_csv_semicolon_separated(self): with make_input(FILE_SSV, True) as input: self.assertFalse(input.is_repeatable) self.assertTrue('#sector' in hxl.data(input).tags)
def test_array(self): self.assertTrue(make_input(DATA).is_repeatable) self.assertTrue('#sector' in hxl.data(DATA).tags)
def test_excel(self): with make_input(FILE_EXCEL, True) as input: self.assertTrue(input.is_repeatable)
def test_json_selector(self): with make_input(FILE_JSON_SELECTOR, True, selector="sel1") as input: # TODO pass
def test_xlsx(self): with make_input(FILE_XLSX, True) as input: self.assertTrue(input.is_repeatable)
def test_csv_zipped(self): with make_input(FILE_ZIP, True) as input: self.assertFalse(input.is_repeatable) self.assertTrue('#sector' in hxl.data(input).tags)
def test_csv_latin1(self): with make_input(FILE_CSV_LATIN1, True, encoding="latin1") as input: self.assertTrue('#sector' in hxl.data(input).tags)
def test_zip_invalid(self): """Expect a HXLIOException, not a meaningless TypeError""" with self.assertRaises(hxl.io.HXLIOException): make_input(FILE_ZIP_INVALID, True)
def test_json_objects(self): with make_input(FILE_JSON_OBJECTS, True) as input: self.assertFalse(input.is_repeatable) self.assertTrue('#sector' in hxl.data(input).tags)