def test_render_missing_fetch_result_returns_empty(self): kwargs = { 'googlefileselect': { **default_googlefileselect, 'mimeType': 'text/csv', } } result = googlesheets.render(pd.DataFrame(), P(), fetch_result=None) assert_frame_equal(result, pd.DataFrame())
def test_render(self): self.requests.get.return_value = MockResponse(200, example_csv) kwargs = { 'googlefileselect': { **default_googlefileselect, 'mimeType': 'text/csv', } } fetch_result = fetch(**kwargs) result = googlesheets.render(pd.DataFrame(), P(**kwargs), fetch_result=fetch_result) assert_frame_equal(result, expected_table)
def test_no_first_row_header(self): self.requests.get.return_value = MockResponse(200, example_csv) kwargs = { 'file': { **default_file, 'mimeType': 'text/csv' }, 'has_header': False, } fetch_result = fetch(P(**kwargs), secrets=secrets(default_secret)) result = render(pd.DataFrame(), P(**kwargs), fetch_result=fetch_result) assert_frame_equal( result, pd.DataFrame({ '0': ['foo', '1', '2'], '1': ['bar', '2', '3'], }))
def test_no_first_row_header(self): self.requests.get.return_value = MockResponse(200, example_csv) kwargs = { "file": { **default_file, "mimeType": "text/csv" }, "has_header": False } fetch_result = fetch(P(**kwargs), secrets=secrets(default_secret)) result = render(pd.DataFrame(), P(**kwargs), fetch_result=fetch_result) assert_frame_equal( result, pd.DataFrame({ "0": ["foo", "1", "2"], "1": ["bar", "2", "3"] }))
def test_render_missing_fetch_result_returns_empty(self): result = render(pd.DataFrame(), P(), fetch_result=None) assert_frame_equal(result, pd.DataFrame())
def test_render(self): self.requests.get.return_value = MockResponse(200, example_csv) kwargs = {'file': {**default_file, 'mimeType': 'text/csv'}} fetch_result = fetch(P(**kwargs), secrets=secrets(default_secret)) result = render(pd.DataFrame(), P(**kwargs), fetch_result=fetch_result) assert_frame_equal(result, expected_table)