def test_parse_custom_list_newline_means_ignore_commas(): assert _parse_custom_list("X,Y\nZ,A\nB,C", ["A", "B", "C"], settings=Settings()) == ({ "A": "X,Y", "B": "Z,A", "C": "B,C" }, [])
def test_parse_custom_list_ignore_no_op_renames(): assert _parse_custom_list("A\nY\nC", ["A", "B", "C"], settings=Settings()) == ( { "B": "Y" }, [], )
def test_parse_custom_list_ignore_trailing_newline(): assert _parse_custom_list("X\nY\n", ["A", "B"], settings=Settings()) == ( { "A": "X", "B": "Y" }, [], ) # no ValueError
def test_parse_custom_list_allow_too_few_columns(): assert _parse_custom_list("X\nY", ["A", "B", "C"], settings=Settings()) == ( { "A": "X", "B": "Y" }, [], )
def test_parse_custom_list_skip_whitespace_columns(): assert _parse_custom_list("X\n\nZ", ["A", "B", "C"], settings=Settings()) == ( { "A": "X", "C": "Z" }, [], )
def test_parse_custom_list_by_newline(): assert _parse_custom_list("X\nY\nZ", ["A", "B", "C"], settings=Settings()) == ( { "A": "X", "B": "Y", "C": "Z" }, [], )
def test_parse_custom_list_by_comma(): assert _parse_custom_list("X, Y, Z", ["A", "B", "C"], settings=Settings()) == ( { "A": "X", "B": "Y", "C": "Z" }, [], )
def test_parse_custom_list_trailing_newline_still_split_by_comma(): # If the user added a newline to the end, it's still commas. assert _parse_custom_list("X, Y, Z\n", ["A", "B", "C"], settings=Settings()) == ( { "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"], settings=Settings()), ({"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"], settings=Settings()), ({"A": "X,Y", "B": "Z,A", "C": "B,C"}, []), )
def test_parse_custom_list_too_many_columns_is_render_error(): with pytest.raises(RenderErrorException): _parse_custom_list("A\nB\nC\nD", ["A", "B", "C"], settings=Settings())
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"], settings=Settings()), ({"A": "X", "B": "Y", "C": "Z"}, []), )
def test_parse_custom_list_allow_too_few_columns(self): self.assertEqual( _parse_custom_list("X\nY", ["A", "B", "C"], settings=Settings()), ({"A": "X", "B": "Y"}, []), )
def test_parse_custom_list_ignore_no_op_renames(self): self.assertEqual( _parse_custom_list("A\nY\nC", ["A", "B", "C"], settings=Settings()), ({"B": "Y"}, []), )
def test_parse_custom_list_by_comma(self): self.assertEqual( _parse_custom_list("X, Y, Z", ["A", "B", "C"], settings=Settings()), ({"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"], settings=Settings()), ({"A": "X", "C": "Z"}, []), )
def test_parse_custom_list_ignore_trailing_newline(self): self.assertEqual( _parse_custom_list("X\nY\n", ["A", "B"], settings=Settings()), ({"A": "X", "B": "Y"}, []), # no ValueError )
def test_parse_custom_list_too_many_columns_is_valueerror(self): with self.assertRaises(UserVisibleError): _parse_custom_list("A\nB\nC\nD", ["A", "B", "C"], settings=Settings())