def test_strip_and_unquote_list_parsec(): """Test strip_and_unquote_list using ParsecValidator.""" for value, results in [('"a"\n"b"', ['a', 'b']), ('"a", "b"', ['a', 'b']), ('"a", "b"', ['a', 'b']), ('"c" # d', ['c']), ('"a", "b", "c" # d', ['a', 'b', 'c']), ('"a"\n"b"\n"c" # d', ['a', 'b', 'c']), ("'a', 'b'", ['a', 'b']), ("'c' #d", ['c']), ("'a', 'b', 'c' # d", ['a', 'b', 'c']), ("'a'\n'b'\n'c' # d", ['a', 'b', 'c']), ('a, b, c,', ['a', 'b', 'c']), ('a, b, c # d', ['a', 'b', 'c']), ('a, b, c\n"d"', ['a', 'b', 'd']), ('a, b, c\n"d" # e', ['a', 'b', '"d"'])]: assert results == ParsecValidator.strip_and_unquote_list(['a'], value)
def test_strip_and_unquote_list(self): for value, results in [ ('"a"\n"b"', ['a', 'b']), ('"a", "b"', ['a', 'b']), ('"a", "b"', ['a', 'b']), ('"c" # d', ['c']), ('"a", "b", "c" # d', ['a', 'b', 'c']), ('"a"\n"b"\n"c" # d', ['a', 'b', 'c']), ("'a', 'b'", ['a', 'b']), ("'c' #d", ['c']), ("'a', 'b', 'c' # d", ['a', 'b', 'c']), ("'a'\n'b'\n'c' # d", ['a', 'b', 'c']), ('a, b, c,', ['a', 'b', 'c']), ('a, b, c # d', ['a', 'b', 'c']), ('a, b, c\n"d"', ['a', 'b', 'd']), ('a, b, c\n"d" # e', ['a', 'b', '"d"']) ]: self.assertEqual(results, ParsecValidator.strip_and_unquote_list( ['a'], value))
def test_strip_and_unquote_list_multiparam(): with pytest.raises(ListValueError): ParsecValidator.strip_and_unquote_list(['a'], 'a, b, c<a,b>')
def test_strip_and_unquote_list_multiparam(self): with self.assertRaises(ListValueError): ParsecValidator.strip_and_unquote_list( ['a'], 'a, b, c<a,b>' )