Esempio n. 1
0
    def test_file_is_kept_intact(self):
        """Test that the file object passed (string, path, or other) is kept intact."""
        open_file = mock.MagicMock()
        bfh = BaseFileHandler(open_file, {'filename_info': 'bla'},
                              'filetype_info')
        assert bfh.filename == open_file

        from pathlib import Path
        filename = Path('/bla/bla.nc')
        bfh = BaseFileHandler(filename, {'filename_info': 'bla'},
                              'filetype_info')
        assert isinstance(bfh.filename, Path)
Esempio n. 2
0
 def setUp(self):
     """Set up the test."""
     self._old_set = BaseFileHandler.__abstractmethods__
     BaseFileHandler._abstractmethods__ = set()
     self.fh = BaseFileHandler('filename', {'filename_info': 'bla'},
                               'filetype_info')