import numpy as np

from spectraforge.core.io import load_npy


def test_load_npy_detects_sensor_from_name(tmp_path) -> None:
    arr = np.zeros((13, 4, 5), dtype="float32")
    path = tmp_path / "sentinel2_scene.npy"
    np.save(path, arr)
    raster = load_npy(path)
    assert raster.sensor == "Sentinel-2"
    assert raster.band_names[0] == "B01"
    assert raster.band_names[-1] == "B12"


def test_load_npy_detects_sensor_from_band_count(tmp_path) -> None:
    arr = np.zeros((2, 4, 5), dtype="float32")
    path = tmp_path / "scene.npy"
    np.save(path, arr)
    raster = load_npy(path)
    assert raster.sensor == "Sentinel-1"
    assert raster.band_names == ["VV", "VH"]
