satpy.tests.test_readers module

Test classes and functions in the readers/__init__.py module.

class satpy.tests.test_readers.TestDatasetDict(methodName='runTest')[source]

Bases: TestCase

Test DatasetDict and its methods.

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

setUp()[source]

Create a test DatasetDict.

test_contains()[source]

Test DatasetDict contains method.

test_get_key()[source]

Test ‘get_key’ special functions.

test_getitem()[source]

Test DatasetDict getitem with different arguments.

test_init_dict()[source]

Test DatasetDict init with a regular dict argument.

test_init_noargs()[source]

Test DatasetDict init with no arguments.

test_keys()[source]

Test keys method of DatasetDict.

test_setitem()[source]

Test setitem method of DatasetDict.

class satpy.tests.test_readers.TestFSFile(methodName='runTest')[source]

Bases: TestCase

Test the FSFile class.

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

setUp()[source]

Set up the instance.

tearDown()[source]

Destroy the instance.

test_equality()[source]

Test that FSFile compares equal when it should.

test_fsfile_with_fs_open_file_abides_pathlike()[source]

Test that FSFile abides PathLike for fsspec OpenFile instances.

test_fsfile_with_pathlike()[source]

Test FSFile with path-like object.

test_fsfile_with_regular_filename_abides_pathlike()[source]

Test that FSFile abides PathLike for regular filenames.

test_fsfile_with_regular_filename_and_fs_spec_abides_pathlike()[source]

Test that FSFile abides PathLike for filename+fs instances.

test_hash()[source]

Test that FSFile hashing behaves sanely.

test_open_local_fs_file()[source]

Test opening a localfs file.

test_open_regular_file()[source]

Test opening a regular file.

test_open_zip_fs_openfile()[source]

Test opening a zipfs openfile.

test_open_zip_fs_regular_filename()[source]

Test opening a zipfs with a regular filename provided.

test_regular_filename_is_returned_with_str()[source]

Test that str give the filename.

test_repr_includes_filename()[source]

Test that repr includes the filename.

test_sorting_fsfiles()[source]

Test sorting FSFiles.

class satpy.tests.test_readers.TestFindFilesAndReaders(methodName='runTest')[source]

Bases: TestCase

Test the find_files_and_readers utility function.

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

setUp()[source]

Wrap HDF5 file handler with our own fake handler.

tearDown()[source]

Stop wrapping the HDF5 file handler.

test_bad_sensor()[source]

Test bad sensor doesn’t find any files.

test_no_parameters()[source]

Test with no limiting parameters.

test_old_reader_name_mapping()[source]

Test that requesting old reader names raises a warning.

test_pending_old_reader_name_mapping()[source]

Test that requesting pending old reader names raises a warning.

test_reader_load_failed()[source]

Test that an exception is raised when a reader can’t be loaded.

test_reader_name()[source]

Test with default base_dir and reader specified.

test_reader_name_matched_end_time()[source]

Test with end matching the filename.

End time in the middle of the file time should still match the file.

test_reader_name_matched_start_end_time()[source]

Test with start and end time matching the filename.

test_reader_name_matched_start_time()[source]

Test with start matching the filename.

Start time in the middle of the file time should still match the file.

test_reader_name_unmatched_start_end_time()[source]

Test with start and end time matching the filename.

test_reader_other_name()[source]

Test with default base_dir and reader specified.

test_sensor()[source]

Test that readers for the current sensor are loaded.

test_sensor_no_files()[source]

Test that readers for the current sensor are loaded.

class satpy.tests.test_readers.TestGroupFiles(methodName='runTest')[source]

Bases: TestCase

Test the ‘group_files’ utility function.

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

setUp()[source]

Set up test filenames to use.

test_bad_reader()[source]

Test that reader not existing causes an error.

test_default_behavior()[source]

Test the default behavior with the ‘abi_l1b’ reader.

test_default_behavior_set()[source]

Test the default behavior with the ‘abi_l1b’ reader.

test_large_time_threshold()[source]

Test what happens when the time threshold holds multiple files.

test_multi_readers()[source]

Test passing multiple readers.

test_multi_readers_empty_groups_missing_skip()[source]

Verify empty groups are skipped.

Verify that all groups lacking ABI are skipped, resulting in only three groups that are all non-empty for both instruments.

test_multi_readers_empty_groups_passed()[source]

Verify that all groups are there, resulting in some that are empty.

test_multi_readers_empty_groups_raises_filenotfounderror()[source]

Test behaviour on empty groups passing multiple readers.

Make sure it raises an exception, for there will be groups containing GLM but not ABI.

test_multi_readers_invalid_parameter()[source]

Verify that invalid missing parameter raises ValueError.

test_no_reader()[source]

Test that reader does not need to be provided.

test_non_datetime_group_key()[source]

Test what happens when the start_time isn’t used for grouping.

test_two_instruments_files()[source]

Test the behavior when two instruments files are provided.

This is undesired from a user point of view since we don’t want G16 and G17 files in the same Scene. Readers (like abi_l1b) are or can be configured to have specific group keys for handling these situations. Due to that this test forces the fallback group keys of (‘start_time’,).

test_two_instruments_files_split()[source]

Test the default behavior when two instruments files are provided and split.

Tell the sorting to include the platform identifier as another field to use for grouping.

test_unknown_files()[source]

Test that error is raised on unknown files.

test_viirs_orbits()[source]

Test a reader that doesn’t use ‘start_time’ for default grouping.

test_viirs_override_keys()[source]

Test overriding a group keys to add ‘start_time’.

class satpy.tests.test_readers.TestReaderLoader(methodName='runTest')[source]

Bases: TestCase

Test the load_readers function.

Assumes that the VIIRS SDR reader exists and works.

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

setUp()[source]

Wrap HDF5 file handler with our own fake handler.

tearDown()[source]

Stop wrapping the HDF5 file handler.

test_all_filtered()[source]

Test behaviour if no file matches the filter parameters.

test_all_filtered_multiple()[source]

Test behaviour if no file matches the filter parameters.

test_almost_all_filtered()[source]

Test behaviour if only one reader has datasets.

test_bad_reader_name_with_filenames()[source]

Test bad reader name with filenames provided.

test_empty_filenames_as_dict()[source]

Test passing filenames as a dictionary with an empty list of filenames.

test_filenames_and_reader()[source]

Test with filenames and reader specified.

test_filenames_as_dict()[source]

Test loading readers where filenames are organized by reader.

test_filenames_as_dict_bad_reader()[source]

Test loading with filenames dict but one of the readers is bad.

test_filenames_as_dict_with_reader()[source]

Test loading from a filenames dict with a single reader specified.

This can happen in the deprecated Scene behavior of passing a reader and a base_dir.

test_filenames_as_path()[source]

Test with filenames specified as pathlib.Path.

test_filenames_only()[source]

Test with filenames specified.

test_missing_requirements(*mocks)[source]

Test warnings and exceptions in case of missing requirements.

test_no_args()[source]

Test no args provided.

This should check the local directory which should have no files.

class satpy.tests.test_readers.TestYAMLFiles(methodName='runTest')[source]

Bases: TestCase

Test and analyze the reader configuration files.

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

setUp()[source]

Set up monkeypatch.

test_available_readers()[source]

Test the ‘available_readers’ function.

test_available_readers_base_loader()[source]

Test the ‘available_readers’ function for yaml loader type BaseLoader.

test_filename_matches_reader_name()[source]

Test that every reader filename matches the name in the YAML.

satpy.tests.test_readers.make_dataid(**items)[source]

Make a data id.