-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
o Fix all test cases, add unittest.TestCase inheritance. TestCase all…
…ows the class to inherit unittest’s testing functionality, such as assertEqual, assertTrue, and automatic test discovery. This change is needed for writing and executing proper unit tests in a consistent framework, improving code quality and enabling integration with test runners.
- Loading branch information
Showing
4 changed files
with
92 additions
and
89 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
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
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
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,31 +1,32 @@ | ||
import uxarray as ux | ||
|
||
import os | ||
from unittest import TestCase | ||
from pathlib import Path | ||
|
||
current_path = Path(os.path.dirname(os.path.realpath(__file__))) | ||
|
||
gridfile_geos_cs = current_path / "meshfiles" / "geos-cs" / "c12" / "test-c12.native.nc4" | ||
|
||
|
||
class Test_GEOS(TestCase): | ||
def test_read_geos_cs_grid(self): | ||
"""Tests the conversion of a CS12 GEOS-CS Grid to the UGRID conventions. | ||
def test_read_geos_cs_grid(): | ||
"""Tests the conversion of a CS12 GEOS-CS Grid to the UGRID conventions. | ||
A CS12 grid has 6 faces, each with 12x12 faces and 13x13 nodes each. | ||
""" | ||
|
||
A CS12 grid has 6 faces, each with 12x12 faces and 13x13 nodes each. | ||
""" | ||
uxgrid = ux.open_grid(gridfile_geos_cs) | ||
|
||
uxgrid = ux.open_grid(gridfile_geos_cs) | ||
n_face = 6 * 12 * 12 | ||
n_node = 6 * 13 * 13 | ||
|
||
n_face = 6 * 12 * 12 | ||
n_node = 6 * 13 * 13 | ||
assert uxgrid.n_face == n_face | ||
assert uxgrid.n_node == n_node | ||
|
||
assert uxgrid.n_face == n_face | ||
assert uxgrid.n_node == n_node | ||
|
||
def test_read_geos_cs_uxds(self): | ||
"""Tests the creating of a UxDataset from a CS12 GEOS-CS Grid.""" | ||
uxds = ux.open_dataset(gridfile_geos_cs, gridfile_geos_cs) | ||
|
||
def test_read_geos_cs_uxds(): | ||
"""Tests the creating of a UxDataset from a CS12 GEOS-CS Grid.""" | ||
uxds = ux.open_dataset(gridfile_geos_cs, gridfile_geos_cs) | ||
|
||
assert uxds['T'].shape[-1] == uxds.uxgrid.n_face | ||
assert uxds['T'].shape[-1] == uxds.uxgrid.n_face |