Making objective_lens a thing

This commit is contained in:
Ian Roddis committed 2026-08-04 16:48:00 -03:00
1 parent fcb4dbaa62
commit 12e6984c63
17 files changed
+115 -119

No files matched your search

+10 -10
View File
@@ -19,7 +19,7 @@ HEADERS = [
"model",
"magnification_min",
"magnification_max",
"objective_lens_outside_diameter_mm",
"objective_lens_diameter_mm",
"model_suffix",
"sub_part_type",
"product_number",
@@ -52,7 +52,7 @@ def _scope_row(**overrides):
"model": "Viper",
"magnification_min": 5,
"magnification_max": 25,
"objective_lens_outside_diameter_mm": 56,
"objective_lens_diameter_mm": 56,
"model_suffix": "PST",
"sub_part_type": "Riflescope",
"product_number": "SCOPE-A",
@@ -141,6 +141,7 @@ async def test_import_creates_scope_with_info_and_attachment_points(db_sessionma
assert info.magnification_min == 5
assert info.magnification_max == 25
assert info.model_suffix == "PST"
assert info.objective_lens_diameter_mm == 56
assert info.objective_thread_pitch == "0.75"
aps = await attachment_point_crud.list_for_augmented_part(db, part.id)
@@ -151,14 +152,13 @@ async def test_import_creates_scope_with_info_and_attachment_points(db_sessionma
assert len(by_label["Ocular"]) == 1
assert by_label["Ocular"][0].static_connection.od_mm == 40
# The lens diameter is descriptive only: the sole Objective point is the
# thread.
objectives = by_label["Objective"]
assert len(objectives) == 2 # static OD + thread
static_obj = [a for a in objectives if a.static_connection is not None]
thread_obj = [a for a in objectives if a.iso_thread is not None]
assert static_obj and static_obj[0].static_connection.od_mm == 56
assert thread_obj
assert thread_obj[0].iso_thread.diameter_mm == 40
assert thread_obj[0].iso_thread.pitch_mm == 0.75
assert len(objectives) == 1
assert objectives[0].static_connection is None
assert objectives[0].iso_thread.diameter_mm == 40
assert objectives[0].iso_thread.pitch_mm == 0.75
async def test_import_resolves_ocular_and_objective_fits(db_sessionmaker):
@@ -200,7 +200,7 @@ async def test_import_upserts_on_product_number(db_sessionmaker):
# Attachment points were rebuilt, not duplicated.
aps = await attachment_point_crud.list_for_augmented_part(db, matching[0].id)
assert len(aps) == 3
assert len(aps) == 2
async def test_row_without_product_number_is_skipped(db_sessionmaker):