|
8 | 8 |
|
9 | 9 | import pytest |
10 | 10 | from helpers import dataclasses_are_equal |
| 11 | +from vtk import vtkImageData, vtkPolyData |
11 | 12 |
|
12 | 13 | from openlifu import Point, Solution |
13 | 14 | from openlifu.db import Session, Subject |
@@ -497,6 +498,19 @@ def test_write_photoscan(example_database:Database, example_session: Session, tm |
497 | 498 | with pytest.raises(FileNotFoundError, match="does not exist"): |
498 | 499 | example_database.write_photoscan(example_session.subject_id, example_session.id, photoscan, model_data_path, bogus_texture_file, on_conflict=OnConflictOpts.OVERWRITE) |
499 | 500 |
|
| 501 | +def test_load_photoscan(example_database:Database, example_session:Session): |
| 502 | + with pytest.raises(FileNotFoundError,match="Photoscan file not found"): |
| 503 | + example_database.load_photoscan(example_session.subject_id, example_session.id, "bogus_photoscan_id") |
| 504 | + |
| 505 | + example_photoscan = example_database.load_photoscan(example_session.subject_id, example_session.id, "example_photoscan") |
| 506 | + assert example_photoscan.name == "ExamplePhotoscan" |
| 507 | + |
| 508 | + example_photoscan, (model_data, texture_data) = example_database.load_photoscan(example_session.subject_id, example_session.id, "example_photoscan", load_data=True) |
| 509 | + assert model_data is not None |
| 510 | + assert texture_data is not None |
| 511 | + assert isinstance(model_data, vtkPolyData) |
| 512 | + assert isinstance(texture_data,vtkImageData) |
| 513 | + |
500 | 514 | def test_session_created_date(): |
501 | 515 | """Test that created date is recent when a session is created.""" |
502 | 516 | tolerance = timedelta(seconds=2) # Allow for minor timing discrepancies |
|
0 commit comments