| 1 |
import pytest |
| 2 |
|
| 3 |
import pycolmap |
| 4 |
|
| 5 |
|
| 6 |
def test_camera_mode_enum(): |
| 7 |
assert {k: int(v) for k, v in pycolmap.CameraMode.__members__.items()} == { |
| 8 |
"AUTO": 0, |
| 9 |
"SINGLE": 1, |
| 10 |
"PER_FOLDER": 2, |
| 11 |
"PER_IMAGE": 3, |
| 12 |
} |
| 13 |
|
| 14 |
|
| 15 |
def test_file_copy_type_enum(): |
| 16 |
assert { |
| 17 |
k: int(v) for k, v in pycolmap.FileCopyType.__members__.items() |
| 18 |
} == { |
| 19 |
"copy": 0, |
| 20 |
"hardlink": 1, |
| 21 |
"softlink": 2, |
| 22 |
} |
| 23 |
|
| 24 |
|
| 25 |
def test_image_reader_options_init(): |
| 26 |
options = pycolmap.ImageReaderOptions() |
| 27 |
assert options is not None |
| 28 |
|
| 29 |
|
| 30 |
def test_image_reader_options_camera_model(): |
| 31 |
options = pycolmap.ImageReaderOptions() |
| 32 |
options.camera_model = "SIMPLE_PINHOLE" |
| 33 |
assert options.camera_model == "SIMPLE_PINHOLE" |
| 34 |
|
| 35 |
|
| 36 |
def test_image_reader_options_check(): |
| 37 |
options = pycolmap.ImageReaderOptions() |
| 38 |
assert options.check() |
| 39 |
|
| 40 |
|
| 41 |
@pytest.mark.parametrize( |
| 42 |
"name", |
| 43 |
[ |
| 44 |
"import_images", |
| 45 |
"infer_camera_from_image", |
| 46 |
"undistort_images", |
| 47 |
], |
| 48 |
) |
| 49 |
def test_public_api_callable(name): |
| 50 |
assert callable(getattr(pycolmap, name)) |