def test_load_bad_data(self): """Test error from trying to load unserialisable data.""" fname = self._path_for("test5") with open(fname, "w") as fh: fh.write(TEST_BAD_YAML) with self.assertRaises(HomeAssistantError): load_yaml(fname)
def test_overwrite_and_reload(self): """Test that we can overwrite an existing file and read back.""" fname = self._path_for("test3") save_yaml(fname, self.yaml.load(TEST_YAML_A)) save_yaml(fname, self.yaml.load(TEST_YAML_B)) data = load_yaml(fname) self.assertEqual(data, self.yaml.load(TEST_YAML_B))
def test_save_and_load(self): """Test saving and loading back.""" fname = self._path_for("test1") save_yaml(fname, self.yaml.load(TEST_YAML_A)) data = load_yaml(fname) self.assertEqual(data, self.yaml.load(TEST_YAML_A))