def test_dump_file(self, tmpdir): tmpfile = tmpdir / 'foo.yml' with tmpfile.open('w', encoding='utf-8') as f: utils.yaml_dump([1, 2], f) assert tmpfile.read() == '- 1\n- 2\n'
def test_dump(self): assert utils.yaml_dump([1, 2]) == '- 1\n- 2\n'
def test_dump_file(self, tmp_path): tmpfile = tmp_path / 'foo.yml' tmpfile.write_text(utils.yaml_dump([1, 2]), encoding='utf-8') assert tmpfile.read_text() == '- 1\n- 2\n'