Exemplo n.º 1
0
 def test_repr(self):
     zip = StatscanZip(RAIL_DATA_URL)
     print(zip)
     self.assertTrue("Statscan" in str(zip))
Exemplo n.º 2
0
 def test_create_from_url_with_params(self):
     dataset: StatscanZip = StatscanZip(
         'https://www150.statcan.gc.ca/n1/en/tbl/csv/38100092-eng.zip?st=yQYQGvmD'
     )
     self.assertIsNotNone(dataset)
Exemplo n.º 3
0
 def test_get_data_calls_fetch_once(self):
     url = "https://www150.statcan.gc.ca/n1/tbl/csv/23100274-eng.zip"
     zip: StatscanZip = StatscanZip(url)
     data = zip.get_data()
     self.assertGreater(len(data), 10)
Exemplo n.º 4
0
 def test_get_pivot_column(self):
     zip = StatscanZip(RAIL_DATA_URL)
     metadata: StatscanMetadata = zip.get_metadata()
     pivot_column = metadata.pivot_column()
     self.assertEqual('Indicator', pivot_column)
Exemplo n.º 5
0
 def test_get_data_multiple_times(self):
     zip = StatscanZip(RAIL_DATA_URL)
     data = zip.get_data()
     self.assertTrue("Companies" in data.columns)
     zip.get_data()
Exemplo n.º 6
0
 def test_get_dimensions(self):
     zip = StatscanZip(RAIL_DATA_URL)
     metadata: StatscanMetadata = zip.get_metadata()
     print(metadata.dimensions)
Exemplo n.º 7
0
 def test_get_metadata(self):
     zip = StatscanZip(RAIL_DATA_URL)
     metadata = zip.get_metadata()
     self.assertIsNotNone(metadata)
     self.assertIsNotNone(zip.metadata)
Exemplo n.º 8
0
 def test_ref_date(self):
     zip = StatscanZip(
         'https://www150.statcan.gc.ca/n1/tbl/csv/23100274-eng.zip')
     data = zip.get_data()
     self.assertEqual(data.Date.dtype, '<M8[ns]')
Exemplo n.º 9
0
 def test_get_data(self):
     zip = StatscanZip(RAIL_DATA_URL)
     data = zip.get_data()
     self.assertTrue("Companies" in data.columns)
     self.assertTrue("Terminal dwell-time" in data.columns)
     self.assertTrue(len(data) > 60)
Exemplo n.º 10
0
def download_prices():
    return StatscanZip(
        'https://www150.statcan.gc.ca/n1/tbl/csv/18100251-eng.zip').get_data()