From 4fcfaec57f162336a1f80c6f9d29f976de7ee2c3 Mon Sep 17 00:00:00 2001 From: ikyasam18 Date: Tue, 26 Nov 2024 17:53:20 +0900 Subject: [PATCH] test: Add test cases for TupleParameter invalid string handling --- test/parameter_test.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/test/parameter_test.py b/test/parameter_test.py index 625a1f200d..622aff5b17 100644 --- a/test/parameter_test.py +++ b/test/parameter_test.py @@ -567,6 +567,18 @@ class Foo(luigi.Task): self.assertEqual(hash(Foo(args=('foo', 'bar')).args), hash(p.normalize(p.parse('["foo", "bar"]')))) + def test_tuple_invalid_string(self): + param = luigi.TupleParameter() + self.assertRaises(ValueError, lambda: param.parse('("abcd")')) + + def test_tuple_invalid_string_in_tuple(self): + param = luigi.TupleParameter() + self.assertRaises(ValueError, lambda: param.parse('(("abcd"))')) + + def test_parse_invalid_format(self): + param = luigi.TupleParameter() + self.assertRaises(SyntaxError, lambda: param.parse('((1,2),(3,4')) + def test_task(self): class Bar(luigi.Task): pass @@ -1225,6 +1237,7 @@ class LocalParameters1304Test(LuigiTestCase): https://github.com/spotify/luigi/issues/1304#issuecomment-148402284 """ + def test_local_params(self): class MyTask(RunOnceTask):