Add test for extract bands metod
* Add test for extract bands metod
Test checking deep copy of Map Feature Task
* isclose replaced with approx
added test for old value
* rename variable
@@ -21,6 +21,7 @@ from fs.osfs import OSFS
from fs.tempfs import TempFS
from fs_s3fs import S3FS
from numpy.testing import assert_equal
+from pytest import approx
from sentinelhub import CRS
@@ -425,6 +426,11 @@ def test_extract_bands(test_eopatch):
patch = move_bands(test_eopatch)
assert np.array_equal(patch.data["MOVED_BANDS"], patch.data["REFERENCE_SCENES"][..., bands])
+ old_value = patch.data["MOVED_BANDS"][0, 0, 0, 0]
+ patch.data["MOVED_BANDS"][0, 0, 0, 0] += 1.0
+ assert patch.data["REFERENCE_SCENES"][0, 0, 0, bands[0]] == old_value
+ assert old_value + 1.0 == approx(patch.data["MOVED_BANDS"][0, 0, 0, 0])
+
bands = [2, 4, 16]
move_bands = ExtractBandsTask((FeatureType.DATA, "REFERENCE_SCENES"), (FeatureType.DATA, "MOVED_BANDS"), bands)
with pytest.raises(ValueError):
