예제 #1
0
 def test_http_xls(self):
     url = 'http://www.messytables.org/static/simple.xls'
     httpretty.register_uri(httpretty.GET,
                            url,
                            body=horror_fobj('simple.xls').read(),
                            content_type="application/ms-excel")
     fh = urlopen(url)
     table_set = XLSTableSet(fh)
     row_set = table_set.tables[0]
     data = list(row_set)
     assert_equal(7, len(data))
예제 #2
0
 def test_http_csv_encoding(self):
     url = 'http://www.messytables.org/static/utf-16le_encoded.csv'
     httpretty.register_uri(httpretty.GET,
                            url,
                            body=horror_fobj('utf-16le_encoded.csv').read(),
                            content_type="application/csv")
     fh = urlopen(url)
     table_set = CSVTableSet(fh)
     row_set = table_set.tables[0]
     data = list(row_set)
     assert_equal(328, len(data))
예제 #3
0
 def test_http_xlsx(self):
     url = 'http://www.messytables.org/static/simple.xlsx'
     httpretty.register_uri(
         httpretty.GET, url,
         body=horror_fobj('simple.xlsx').read(),
         content_type="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet")
     fh = urlopen(url)
     table_set = XLSTableSet(fh)
     row_set = table_set.tables[0]
     data = list(row_set)
     assert_equal(7, len(data))
예제 #4
0
 def test_http_xls(self):
     url = 'http://www.messytables.org/static/simple.xls'
     httpretty.register_uri(
         httpretty.GET, url,
         body=horror_fobj('simple.xls').read(),
         content_type="application/ms-excel")
     fh = urlopen(url)
     table_set = XLSTableSet(fh)
     row_set = table_set.tables[0]
     data = list(row_set)
     assert_equal(7, len(data))
예제 #5
0
 def test_http_csv_encoding(self):
     url = 'http://www.messytables.org/static/utf-16le_encoded.csv'
     httpretty.register_uri(
         httpretty.GET, url,
         body=horror_fobj('utf-16le_encoded.csv').read(),
         content_type="application/csv")
     fh = urlopen(url)
     table_set = CSVTableSet(fh)
     row_set = table_set.tables[0]
     data = list(row_set)
     assert_equal(328, len(data))
예제 #6
0
 def test_http_xlsx(self):
     url = 'http://www.messytables.org/static/simple.xlsx'
     httpretty.register_uri(
         httpretty.GET,
         url,
         body=horror_fobj('simple.xlsx').read(),
         content_type=
         "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
     )
     fh = urlopen(url)
     table_set = XLSTableSet(fh)
     row_set = table_set.tables[0]
     data = list(row_set)
     assert_equal(7, len(data))