-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
remove duplicate tests and add test for file validation
- Loading branch information
1 parent
57985a3
commit f2d3cce
Showing
1 changed file
with
32 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,36 @@ | ||
"""Tests for manipulating netCDF groups.""" | ||
|
||
# pylint: disable=C0116, C0301 | ||
import logging | ||
from pathlib import Path | ||
|
||
from concatenator.attribute_handling import ( | ||
_flatten_coordinate_attribute, | ||
regroup_coordinate_attribute, | ||
) | ||
|
||
|
||
def test_coordinate_attribute_flattening(): | ||
# Case with groups present and double spaces. | ||
assert ( | ||
_flatten_coordinate_attribute( | ||
"Time_and_Position/time Time_and_Position/instrument_fov_latitude Time_and_Position/instrument_fov_longitude" | ||
) | ||
== "__Time_and_Position__time __Time_and_Position__instrument_fov_latitude __Time_and_Position__instrument_fov_longitude" | ||
) | ||
|
||
# Case with NO groups present and single spaces. | ||
assert ( | ||
_flatten_coordinate_attribute( | ||
"time longitude latitude ozone_profile_pressure ozone_profile_altitude" | ||
) | ||
== "__time __longitude __latitude __ozone_profile_pressure __ozone_profile_altitude" | ||
) | ||
|
||
|
||
def test_coordinate_attribute_regrouping(): | ||
# Case with groups present and double spaces. | ||
assert ( | ||
regroup_coordinate_attribute( | ||
"__Time_and_Position__time __Time_and_Position__instrument_fov_latitude __Time_and_Position__instrument_fov_longitude" | ||
) | ||
== "Time_and_Position/time Time_and_Position/instrument_fov_latitude Time_and_Position/instrument_fov_longitude" | ||
) | ||
|
||
# Case with NO groups present and single spaces. | ||
assert ( | ||
regroup_coordinate_attribute( | ||
"__time __longitude __latitude __ozone_profile_pressure __ozone_profile_altitude" | ||
) | ||
== "time longitude latitude ozone_profile_pressure ozone_profile_altitude" | ||
) | ||
import pytest | ||
|
||
from concatenator.dataset_and_group_handling import validate_workable_files | ||
|
||
from ..conftest import path_str | ||
|
||
logger = logging.getLogger(__name__) | ||
|
||
|
||
@pytest.mark.usefixtures("pass_options") | ||
class TestGroupHandling: | ||
__test_path = Path(__file__).parents[1].resolve() | ||
__data_path = __test_path.joinpath("data") | ||
__harmony_path = __data_path.joinpath("harmony") | ||
__granules_path = __harmony_path.joinpath("granules") | ||
|
||
def test_workable_files_validation(self, temp_output_dir): | ||
filepaths = [ | ||
path_str( | ||
self.__granules_path, "TEMPO_NO2_L2_V03_20240601T210934Z_S012G01_subsetted.nc4" | ||
), | ||
path_str( | ||
self.__granules_path, "TEMPO_NO2_L2_V03_20240601T211614Z_S012G02_subsetted.nc4" | ||
), | ||
path_str( | ||
self.__granules_path, "TEMPO_NO2_L2_V03_20240601T212254Z_S012G03_subsetted.nc4" | ||
), | ||
] | ||
|
||
assert validate_workable_files(filepaths, logger)[1] == 3 |