コード例 #1
0
 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())
コード例 #2
0
 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)
コード例 #3
0
 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'],
         }))
コード例 #4
0
 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"]
         }))
コード例 #5
0
 def test_render_missing_fetch_result_returns_empty(self):
     result = render(pd.DataFrame(), P(), fetch_result=None)
     assert_frame_equal(result, pd.DataFrame())
コード例 #6
0
 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)