2323
2424import pytest
2525
26- from aiscot .ais_functions import read_known_craft_fd
27- from aiscot .constants import DEFAULT_MID_DB_FILE , DEFAULT_SHIP_DB_FILE
28- from aiscot .functions import ais_to_cot , cot_to_xml
26+ import aiscot
2927
3028
3129@pytest .fixture
@@ -115,11 +113,11 @@ def sample_known_craft():
115113366892000,TACO_01,a-f-S-T-A-C-O,
116114"""
117115 csv_fd = io .StringIO (sample_csv )
118- return read_known_craft_fd (csv_fd )
116+ return aiscot . ais_functions . read_known_craft_fd (csv_fd )
119117
120118
121119def test_ais_to_cot (sample_data_pyAISm ):
122- cot = ais_to_cot (sample_data_pyAISm )
120+ cot = aiscot . ais_to_cot (sample_data_pyAISm )
123121 assert isinstance (cot , ET .Element )
124122 assert cot .tag == "event"
125123 assert cot .attrib ["version" ] == "2.0"
@@ -154,7 +152,7 @@ def test_ais_to_cot_with_known_craft(sample_data_pyAISm, sample_known_craft):
154152 or [{}]
155153 )[0 ]
156154
157- cot = ais_to_cot (sample_data_pyAISm , known_craft = known_craft )
155+ cot = aiscot . ais_to_cot (sample_data_pyAISm , known_craft = known_craft )
158156
159157 assert isinstance (cot , ET .Element )
160158 assert cot .tag == "event"
@@ -181,9 +179,9 @@ def test_ais_to_cot_with_known_craft(sample_data_pyAISm, sample_known_craft):
181179
182180
183181def test_ais_to_cot_none ():
184- """Test that `ais_to_cot()` only renders valid input data."""
182+ """Test that `aiscot. ais_to_cot()` only renders valid input data."""
185183 assert (
186- ais_to_cot (
184+ aiscot . ais_to_cot (
187185 {
188186 "mmsi" : 366892000 ,
189187 "lon" : 0 ,
@@ -193,7 +191,7 @@ def test_ais_to_cot_none():
193191 is None
194192 )
195193 assert (
196- ais_to_cot (
194+ aiscot . ais_to_cot (
197195 {
198196 "mmsi" : 366892000 ,
199197 "lon" : - 122.51208 ,
@@ -203,7 +201,7 @@ def test_ais_to_cot_none():
203201 is None
204202 )
205203 assert (
206- ais_to_cot (
204+ aiscot . ais_to_cot (
207205 {
208206 "mmsi" : "" ,
209207 "lon" : - 122.51208 ,
@@ -212,23 +210,23 @@ def test_ais_to_cot_none():
212210 )
213211 is None
214212 )
215- assert ais_to_cot ({}) is None
213+ assert aiscot . ais_to_cot ({}) is None
216214
217215
218216def test_ais_to_cot_dont_ignore_aton (sample_aton ):
219217 """Test ignoring Aids to Naviation (ATON)."""
220- assert ais_to_cot (sample_aton , {"IGNORE_ATON" : False }) is not None
218+ assert aiscot . ais_to_cot (sample_aton , {"IGNORE_ATON" : False }) is not None
221219
222220
223221def test_ais_to_cot_ignore_aton (sample_aton ):
224222 """Test ignoring Aids to Naviation (ATON)."""
225- assert ais_to_cot (sample_aton , {"IGNORE_ATON" : True }) is None
223+ assert aiscot . ais_to_cot (sample_aton , {"IGNORE_ATON" : True }) is None
226224
227225
228226def test_ais_to_cot_shipname (sample_data_pyAISm ):
229227 """Test converting AIS to CoT with a known shipname."""
230228 sample_data_pyAISm ["mmsi" ] = "303990000"
231- cot = ais_to_cot (sample_data_pyAISm )
229+ cot = aiscot . ais_to_cot (sample_data_pyAISm )
232230
233231 detail = cot .findall ("detail" )
234232 assert detail [0 ].tag == "detail"
@@ -240,7 +238,7 @@ def test_ais_to_cot_shipname(sample_data_pyAISm):
240238def test_ais_to_cot_sar (sample_data_pyAISm ):
241239 """Test converting AIS to CoT for a SAR vessel."""
242240 sample_data_pyAISm ["mmsi" ] = "303862000"
243- cot = ais_to_cot (sample_data_pyAISm )
241+ cot = aiscot . ais_to_cot (sample_data_pyAISm )
244242
245243 assert cot .tag == "event"
246244 assert cot .attrib ["type" ] == "a-f-S-X-L"
@@ -249,14 +247,14 @@ def test_ais_to_cot_sar(sample_data_pyAISm):
249247def test_ais_to_cot_crs (sample_data_pyAISm ):
250248 """Test converting AIS to CoT for a CRS vessel."""
251249 sample_data_pyAISm ["mmsi" ] = "3669123"
252- cot = ais_to_cot (sample_data_pyAISm )
250+ cot = aiscot . ais_to_cot (sample_data_pyAISm )
253251
254252 assert cot .tag == "event"
255253 assert cot .attrib ["type" ] == "a-f-G-I-U-T"
256254
257255
258256def test_ais_to_cot (sample_data_pyAISm ):
259257 """Test converting AIS to CoT."""
260- cot : bytes = cot_to_xml (sample_data_pyAISm )
258+ cot : bytes = aiscot . cot_to_xml (sample_data_pyAISm )
261259 assert b"a-f-S-X-M" in cot
262260 assert b"MMSI-366892000" in cot
0 commit comments