Exemplo n.º 1
0
    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)
Exemplo n.º 2
0
 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)
Exemplo n.º 3
0
 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)
Exemplo n.º 4
0
 def test_array(self):
     self.assertTrue(make_input(DATA).is_repeatable)
     self.assertTrue('#sector' in hxl.data(DATA).tags)
Exemplo n.º 5
0
 def test_excel(self):
     with make_input(FILE_EXCEL, True) as input:
         self.assertTrue(input.is_repeatable)
Exemplo n.º 6
0
 def test_json_selector(self):
     with make_input(FILE_JSON_SELECTOR, True, selector="sel1") as input:
         # TODO
         pass
Exemplo n.º 7
0
 def test_json_selector(self):
     with make_input(FILE_JSON_SELECTOR, True, selector="sel1") as input:
         # TODO
         pass
Exemplo n.º 8
0
 def test_xlsx(self):
     with make_input(FILE_XLSX, True) as input:
         self.assertTrue(input.is_repeatable)
Exemplo n.º 9
0
 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)
Exemplo n.º 10
0
 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)
Exemplo n.º 11
0
 def test_array(self):
     self.assertTrue(make_input(DATA).is_repeatable)
     self.assertTrue('#sector' in hxl.data(DATA).tags)
Exemplo n.º 12
0
 def test_excel(self):
     with make_input(FILE_EXCEL, True) as input:
         self.assertTrue(input.is_repeatable)
Exemplo n.º 13
0
 def test_csv_latin1(self):
     with make_input(FILE_CSV_LATIN1, True, encoding="latin1") as input:
         self.assertTrue('#sector' in hxl.data(input).tags)
Exemplo n.º 14
0
 def test_zip_invalid(self):
     """Expect a HXLIOException, not a meaningless TypeError"""
     with self.assertRaises(hxl.io.HXLIOException):
         make_input(FILE_ZIP_INVALID, True)
Exemplo n.º 15
0
 def test_zip_invalid(self):
     """Expect a HXLIOException, not a meaningless TypeError"""
     with self.assertRaises(hxl.io.HXLIOException):
         make_input(FILE_ZIP_INVALID, True)
Exemplo n.º 16
0
 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)
Exemplo n.º 17
0
 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)