def test_get_dataframe_4(self): # test with name=auto, top_x=5, threshold=7 (so threshold leaves fewer than 3 results) test_wc = WorkflowManager([]) test_wc._result = pandas.Series([i for i in xrange(10, 0, -1)]) expected = pandas.DataFrame({'data': pandas.Series([10, 9, 8])}) actual = test_wc._get_dataframe(top_x=5, threshold=7) self.assertEqual(len(expected.columns), len(actual.columns)) for i in expected.columns: self.assertSequenceEqual(list(expected.loc[:,i].index), list(actual.loc[:,i].index)) self.assertSequenceEqual(list(expected.loc[:,i].values), list(actual.loc[:,i].values))
def test_get_dataframe_2(self): # test with name='asdf', top_x=3, threshold=auto test_wc = WorkflowManager([]) test_wc._result = pandas.Series([i for i in xrange(10, 0, -1)]) expected = pandas.DataFrame({'asdf': pandas.Series([10, 9, 8])}) actual = test_wc._get_dataframe('asdf', 3) self.assertEqual(len(expected.columns), len(actual.columns)) for i in expected.columns: self.assertSequenceEqual(list(expected.loc[:,i].index), list(actual.loc[:,i].index)) self.assertSequenceEqual(list(expected.loc[:,i].values), list(actual.loc[:,i].values))