Пример #1
0
 def test_txt_detect_separator_comma(self):
     result = parse_bytesio(io.BytesIO(b'A,C\nB,D'),
                            'text/plain', 'utf-8')
     expected = ProcessResult(pd.DataFrame({'A': ['B'], 'C': ['D']}))
     self.assertEqual(result, expected)
Пример #2
0
 def test_csv_detect_separator_semicolon(self):
     result = parse_bytesio(io.BytesIO(b'A;C\nB;D'), 'text/csv', 'utf-8')
     expected = ProcessResult(pd.DataFrame({'A': ['B'], 'C': ['D']}))
     self.assertEqual(result, expected)
def render(wf_module):
    result = ScrapeTable.render(wf_module, pd.DataFrame())
    result = ProcessResult.coerce(result)
    return result
 def test_invalid_url(self):
     wf_module = fetch(url='not a url')
     result = render(wf_module)
     self.assertEqual(result, ProcessResult(error='Invalid URL'))
Пример #5
0
 def test_empty_secret(self):
     wf_module = MockWfModule(twitter_credentials=None)
     run_fetch(wf_module)
     self.commit_result.assert_called_with(
         wf_module, ProcessResult(error='Please sign in to Twitter'))
Пример #6
0
 def test_empty_query(self):
     wf_module = MockWfModule(querytype=1, query='')
     run_fetch(wf_module)
     self.commit_result.assert_called_with(
         wf_module, ProcessResult(error='Please enter a query'))
Пример #7
0
def table_to_result(table):
    result = ProcessResult(table)
    result.sanitize_in_place()  # alters dataframe.equals() result
    return result