def test_duplicated_yaml(self): yml = """ key: value key: value """ (parsed, err) = format.validate(yml) self.assertIsNone(parsed) self.assertEqual(True, 'found duplicate key "key" with value "value" (original value: "value")' in err)
def test_invalid_yaml(self): invalid_yaml = """ key: value - item#1 - item#2 """ (parsed, err) = format.validate(invalid_yaml) self.assertIsNone(parsed) self.assertEqual(err, "did not find expected key")
def test_invalid_yaml(self): invalid_yaml = """ key: value - item#1 - item#2 """ (parsed, err) = format.validate(invalid_yaml) self.assertIsNone(parsed) self.assertEqual(err, "expected <block end>, but found '-'")
def test_valid_yaml(self): valid_yaml = """ key: &my_list - 1 - '2' obj: lst: *my_list """ (parsed, err) = format.validate(valid_yaml) self.assertEqual(parsed, {'key': [1, '2'], 'obj': {'lst': [1, '2']}}) self.assertIsNone(err)