def _check_version_supported(self): """Checks if the ND2 file version is supported by this reader. Returns: bool: True on supported """ major_version, minor_version = get_version(self._fh) supported = self.supported_file_versions.get( (major_version, minor_version)) or self.supported_file_versions.get((major_version, None)) if not supported: print("Warning: No parser is available for your current ND2 version (%d.%d). " % ( major_version, minor_version) + "This might lead to unexpected behaviour.") return supported
def test_get_version_from_file(self): self.create_test_nd2() with open(self.test_file, 'rb') as fh: version_tuple = get_version(fh) self.assertTupleEqual(version_tuple, (3, 0))