import pytest
from default import *

def test_zoom():
  e = setup_equipment()
  row = e.data().iloc[0]
  # Only possiable zoom should be 750/25 = 30
  assert row["zoom"] == 30
  # Only possiable fov should be 1.733 ± 0.001
  assert row["fov"] == pytest.approx(1.733, 0.001)
  # Range 12.880 ± 0.001
  assert row["range"] == pytest.approx(12.880, 0.001)
 
def test_barlow():
  e = setup_equipment()
  e.register(equipment.Barlow(2))
  row = e.data().iloc[0]
  # Only possiable zoom should be 750/25 * 2 = 60
  assert row["zoom"] == 60
  # Using 3 elements
  assert row["elements"] == 3 

def test_barlow_stacking():
  e = setup_equipment()
  e.register(equipment.Barlow(2))
  e.register(equipment.Barlow(3))
  # Get row with biggest zoom 
  row = e.data().sort_values(['zoom'], ascending=[0]).iloc[0]
  # With two stacked barlows max zoom should be 180 (30 * 3 * 2) 
  assert row["zoom"] == 180 
  # Using 4 elements
  assert row["elements"] == 4 
  
def test_multi_barlow():
  e = setup_equipment()
  e.register(equipment.Barlow(2))
  e.register(equipment.Barlow(3))
  # With two barlows and single eyepiece number of possiable connection is 4 (with barlow stacking)
  assert len(e.data()["zoom"]) == 4  

def test_camera():
  e = setup_equipment()
  e.register(equipment.Camera(30, 40, 100, 200))
  # Zoom of camera (sqrt(30^2 + 40^2) = 50)
  data = e.data()
  assert data[data.type == "Image"].iloc[0]["zoom"] == 15
  
  
   

@@ -29,16 +29,47 @@
 mport *%0A
+from apts.utils import Labels%0A%0A
 %0Adef tes
@@ -182,30 +182,35 @@
  assert row%5B
-%22zoom%22
+Labels.ZOOM
 %5D == 30%0A  # 
@@ -269,13 +269,18 @@
 row%5B
-%22fov%22
+Labels.FOV
 %5D ==
@@ -350,15 +350,20 @@
 row%5B
-%22range%22
+Labels.RANGE
 %5D ==
@@ -392,17 +392,17 @@
  0.001)%0A
- 
+%0A
 %0Adef tes
@@ -555,30 +555,35 @@
  assert row%5B
-%22zoom%22
+Labels.ZOOM
 %5D == 60%0A  # 
@@ -616,25 +616,30 @@
 row%5B
-%22elements%22
+Labels.ELEMENTS
 %5D == 3
- 
+%0A
 %0A%0Ade
@@ -821,14 +821,19 @@
 es(%5B
-'zoom'
+Labels.ZOOM
 %5D, a
@@ -937,22 +937,27 @@
 row%5B
-%22zoom%22
+Labels.ZOOM
 %5D == 180
  %0A  
@@ -952,17 +952,16 @@
 %5D == 180
- 
 %0A  # Usi
@@ -991,28 +991,31 @@
 row%5B
-%22elements%22
+Labels.ELEMENTS
 %5D == 4
- %0A  
+%0A%0A
 %0Adef
@@ -1254,23 +1254,27 @@
 a()%5B
-%22zoom%22
+Labels.ZOOM
 %5D) == 4
-  
+%0A
 %0A%0Ade
@@ -1473,28 +1473,23 @@
 %5B0%5D%5B
-%22zoom%22%5D == 15%0A  %0A  %0A   
+Labels.ZOOM%5D == 15
 %0A

Test fixes