Files
DumasNodes/tests/test_dumas_h3_latent_upscale_2d.py
T

30 lines
923 B
Python

import importlib.util
import pathlib
import unittest
ROOT = pathlib.Path(__file__).parents[1]
spec = importlib.util.spec_from_file_location(
"dumas_h3_latent_upscale_2d_test", ROOT / "dumas_h3_latent_upscale_2d.py"
)
module = importlib.util.module_from_spec(spec)
assert spec.loader is not None
spec.loader.exec_module(module)
class H3LatentUpscale2DTests(unittest.TestCase):
def test_ranges_cover_dimension_without_overlap_gap(self):
ranges = module.DumasMMH3LatentUpscale2D._ranges(150, 64, 8)
self.assertEqual(ranges[0], (0, 64))
self.assertEqual(ranges[-1], (86, 150))
for (_, end), (start, _) in zip(ranges, ranges[1:]):
self.assertLessEqual(start, end)
def test_rejects_overlap_equal_to_tile(self):
with self.assertRaises(ValueError):
module.DumasMMH3LatentUpscale2D._ranges(64, 32, 32)
if __name__ == "__main__":
unittest.main()