else:
key = "rst"
- expected_dict[key]= out_style.output_symbols(fname, [arg])
+ expected_dict[key]= out_style.output_symbols(fname, [arg]).strip()
name = f"{base_name}_{i:03d}"
"""
import yaml
+ # Helper function to better handle multilines
+ def str_presenter(dumper, data):
+ if "\n" in data:
+ return dumper.represent_scalar("tag:yaml.org,2002:str", data, style="|")
+
+ return dumper.represent_scalar("tag:yaml.org,2002:str", data)
+
+ # Register the representer
+ yaml.add_representer(str, str_presenter)
+
data = {"tests": self.tests}
with open(self.test_file, "w", encoding="utf-8") as fp:
- yaml.safe_dump(data, fp, sort_keys=False, default_style="|",
- default_flow_style=False, allow_unicode=True)
+ yaml.dump(data, fp,
+ sort_keys=False, width=120, indent=2,
+ default_flow_style=False, allow_unicode=True,
+ explicit_start=False, explicit_end=False)