def verify_yaml(self, yaml_string, config_name, show_file=False): formatted_yaml = YamlRoundtrip.reformat_yaml(yaml_string, show_file=show_file) if formatted_yaml == "null\n...\n": # special case: empty config return if yaml_string.strip() != formatted_yaml.strip(): #self.maxDiff = None #self.assertEqual(yaml_string, formatted_yaml) diff = self.unidiff_output(yaml_string.strip() + "\n", formatted_yaml.strip() + "\n") self.fail("Config {} unformatted. Diff:\n{}".format( config_name, diff))
def _reformat(yaml_string, show_file): new_config = YamlRoundtrip.reformat_yaml(yaml_string, show_file) if new_config == "null\n...\n": return yaml_string return new_config