def test_basic(self): """Tests that a list of strings changes '[' into nested lists""" to_test = [ 'foo', '[', 'bar', 'a', 'b', ']', '[', 'baz', 'c', ']', '-o', 'z' ] expected = ['foo', ['bar', 'a', 'b'], ['baz', 'c'], '-o', 'z'] result = unbracket(to_test) self.assertEqual(result, expected)
def test_basic(self): """Tests that a list of strings changes '[' into nested lists""" to_test = [ "foo", "[", "bar", "a", "b", "]", "[", "baz", "c", "]", "-o", "z" ] expected = ["foo", ["bar", "a", "b"], ["baz", "c"], "-o", "z"] result = unbracket(to_test) self.assertEqual(result, expected)
def test_mismatched_close_brackets(self): """Tests if there isn't a corresponding '[' it raises an error""" msg = 'Mismatched bracket at position' with self.assertRaisesRegex(ValueError, msg): unbracket(['foo', ']', 'bar'])
def test_mismatched_close_brackets(self): """Tests if there isn't a corresponding '[' it raises an error""" msg = "Mismatched bracket at position" with self.assertRaisesRegex(ValueError, msg): unbracket(["foo", "]", "bar"])