def test_parse_custom_list_trailing_newline_still_split_by_comma(self): """If the user added a newline to the end, it's still commas.""" self.assertEqual(_parse_custom_list('X, Y, Z\n', ['A', 'B', 'C']), { 'A': 'X', 'B': 'Y', 'C': 'Z' })
def test_parse_custom_list_newline_means_ignore_commas(self): self.assertEqual(_parse_custom_list('X,Y\nZ,A\nB,C', ['A', 'B', 'C']), { 'A': 'X,Y', 'B': 'Z,A', 'C': 'B,C' })
def test_parse_custom_list_ignore_trailing_newline(self): self.assertEqual( _parse_custom_list('X\nY\n', ['A', 'B']), { 'A': 'X', 'B': 'Y' } # no ValueError )
def test_parse_custom_list_ignore_trailing_newline(self): self.assertEqual( _parse_custom_list("X\nY\n", ["A", "B"]), { "A": "X", "B": "Y" }, # no ValueError )
def test_parse_custom_list_newline_means_ignore_commas(self): self.assertEqual( _parse_custom_list("X,Y\nZ,A\nB,C", ["A", "B", "C"]), { "A": "X,Y", "B": "Z,A", "C": "B,C" }, )
def test_parse_custom_list_by_comma(self): self.assertEqual( _parse_custom_list("X, Y, Z", ["A", "B", "C"]), { "A": "X", "B": "Y", "C": "Z" }, )
def test_parse_custom_list_by_newline(self): self.assertEqual( _parse_custom_list("X\nY\nZ", ["A", "B", "C"]), { "A": "X", "B": "Y", "C": "Z" }, )
def test_parse_custom_list_trailing_newline_still_split_by_comma(self): """If the user added a newline to the end, it's still commas.""" self.assertEqual( _parse_custom_list("X, Y, Z\n", ["A", "B", "C"]), { "A": "X", "B": "Y", "C": "Z" }, )
def test_parse_custom_list_too_many_columns_is_valueerror(self): with self.assertRaisesRegex( ValueError, "You supplied 4 column names, but the table has 3 columns."): _parse_custom_list("A\nB\nC\nD", ["A", "B", "C"])
def test_parse_custom_list_ignore_no_op_renames(self): self.assertEqual(_parse_custom_list("A\nY\nC", ["A", "B", "C"]), {"B": "Y"})
def test_parse_custom_list_allow_too_few_columns(self): self.assertEqual(_parse_custom_list("X\nY", ["A", "B", "C"]), { "A": "X", "B": "Y" })
def test_parse_custom_list_by_comma(self): self.assertEqual(_parse_custom_list('X, Y, Z', ['A', 'B', 'C']), { 'A': 'X', 'B': 'Y', 'C': 'Z' })
def test_parse_custom_list_skip_whitespace_columns(self): self.assertEqual(_parse_custom_list('X\n\nZ', ['A', 'B', 'C']), { 'A': 'X', 'C': 'Z' })
def test_parse_custom_list_too_many_columns_is_valueerror(self): with self.assertRaisesRegex( ValueError, 'You supplied 4 column names, but the table has 3 columns.'): _parse_custom_list('A\nB\nC\nD', ['A', 'B', 'C'])
def test_parse_custom_list_ignore_no_op_renames(self): self.assertEqual(_parse_custom_list('A\nY\nC', ['A', 'B', 'C']), {'B': 'Y'})
def test_parse_custom_list_allow_too_few_columns(self): self.assertEqual(_parse_custom_list('X\nY', ['A', 'B', 'C']), { 'A': 'X', 'B': 'Y' })
def test_parse_custom_list_skip_whitespace_columns(self): self.assertEqual(_parse_custom_list("X\n\nZ", ["A", "B", "C"]), { "A": "X", "C": "Z" })
def test_parse_custom_list_by_newline(self): self.assertEqual(_parse_custom_list('X\nY\nZ', ['A', 'B', 'C']), { 'A': 'X', 'B': 'Y', 'C': 'Z' })