def test_empty_string(self): df = pd.DataFrame(columns=["a", "b", "c", "d", "e", "f"], index=[0, 1], data=[[1, 1, 1, 1, 1, ""], [1, 1, 1, 1, 1, ""]]) expected_result = [("f", 0), ("f", 1)] result = parse_columns(df, self.mock_template) self.assertCountEqual(expected_result, result)
def test_weird_indices_complete(self): df = pd.DataFrame(columns=["a", "b", "c", "d", "e", "f"], index=["apple", "orange"], data=[[1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1]]) expected_result = [] result = parse_columns(df, self.mock_template) self.assertCountEqual(expected_result, result)
def test_only_mandatory_headers(self): df = pd.DataFrame(columns=["a", "e", "f"], index=[0, 1], data=[[1, 1, 1], [1, 1, 1]]) expected_result = [] result = parse_columns(df, self.mock_template) self.assertCountEqual(expected_result, result)
def test_mixed_headers(self): df = pd.DataFrame(columns=["a", "c", "d"], index=[0, 1], data=[[1, 1, 1], [1, 1, 1]]) expected_result = [("e", -1), ("f", -1)] result = parse_columns(df, self.mock_template) self.assertCountEqual(expected_result, result)
def test_complete_two_rows_dataframe(self): df = pd.DataFrame(columns=["a", "b", "c", "d", "e", "f"], index=[0, 1], data=[[1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1]]) expected_result = [] result = parse_columns(df, self.mock_template) self.assertCountEqual(expected_result, result)
def test_no_fields_dataframe(self): df = pd.DataFrame(columns=["a", "b", "c", "d", "e", "f"], index=[0, 1]) expected_result = [("a", 0), ("e", 0), ("f", 0), ("a", 1), ("e", 1), ("f", 1)] result = parse_columns(df, self.mock_template) self.assertCountEqual(expected_result, result)
def test_only_rows_dataframe(self): df = pd.DataFrame(columns=[], index=[1, 1]) expected_result = [("a", -1), ("e", -1), ("f", -1)] result = parse_columns(df, self.mock_template) self.assertCountEqual(expected_result, result)
def test_only_headers_dataframe(self): df = pd.DataFrame(columns=["a", "b", "c", "d", "e", "f"]) expected_result = [("a", -1), ("e", -1), ("f", -1)] result = parse_columns(df, self.mock_template) self.assertCountEqual(expected_result, result)
def test_completely_empty_dataframe(self): df = pd.DataFrame(columns=[]) expected_result = [("a", -1), ("e", -1), ("f", -1)] result = parse_columns(df, self.mock_template) self.assertCountEqual(expected_result, result)