Example #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)
Example #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)
Example #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)
Example #4
0
 def test_array(self):
     self.assertTrue(make_input(DATA).is_repeatable)
     self.assertTrue('#sector' in hxl.data(DATA).tags)
Example #5
0
 def test_excel(self):
     with make_input(FILE_EXCEL, True) as input:
         self.assertTrue(input.is_repeatable)
Example #6
0
 def test_json_selector(self):
     with make_input(FILE_JSON_SELECTOR, True, selector="sel1") as input:
         # TODO
         pass
Example #7
0
 def test_json_selector(self):
     with make_input(FILE_JSON_SELECTOR, True, selector="sel1") as input:
         # TODO
         pass
Example #8
0
 def test_xlsx(self):
     with make_input(FILE_XLSX, True) as input:
         self.assertTrue(input.is_repeatable)
Example #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)
Example #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)
Example #11
0
 def test_array(self):
     self.assertTrue(make_input(DATA).is_repeatable)
     self.assertTrue('#sector' in hxl.data(DATA).tags)
Example #12
0
 def test_excel(self):
     with make_input(FILE_EXCEL, True) as input:
         self.assertTrue(input.is_repeatable)
Example #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)
Example #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)
Example #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)
Example #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)
Example #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)