Exemple #1
0
    def write(self, file_name):
        """
        Writes the DataContainer to a text file.

        For supported file types, see :func:`.fileio.write`.

        Args:
            file_name(str): the name of the file to be writen to.
        """
        write(self.to_builtin(), file_name)
Exemple #2
0
 def test_unsupported_file_raises_error(self):
     """Trying to write to a file with an unknown file extension should raise an error."""
     with self.assertRaises(ValueError,
                            msg="write didn't raise ValueError"):
         write(self.data, "data.foo")
Exemple #3
0
 def test_yaml_consistency(self):
     """Writing the test data to yaml then reading it should leave it unchanged."""
     write(self.data, self.yaml_name)
     self.assertEqual(self.data, read(self.yaml_name),
                      "Read data not the same as written data.")