def test_eval_str_tuple(self): for v in [ '()', '("hello",)', '("hello", "world")', "('hello',)", "('hello', 'world')", "('hello', \"world\")", ]: self.assertEqual(modulegraph._eval_str_tuple(v), eval(v)) self.assertRaises(ValueError, modulegraph._eval_str_tuple, "") self.assertRaises(ValueError, modulegraph._eval_str_tuple, "'a'") self.assertRaises(ValueError, modulegraph._eval_str_tuple, "'a', 'b'") self.assertRaises(ValueError, modulegraph._eval_str_tuple, "('a', ('b', 'c'))") self.assertRaises(ValueError, modulegraph._eval_str_tuple, "('a', ('b\", 'c'))")