Coverage for test/test_annotation_row.py: 100%

433 statements  

« prev     ^ index     » next       coverage.py v7.8.0, created at 2025-04-12 17:57 +0000

1from annotation.annotation_row import AnnotationRow 

2from annotation.timestamp_processor import TimestampProcessor 

3from test.data_for_tests import annotations, dive_dict, concepts 

4from util.constants import HEADERS, NULL_VAL_STRING, NULL_VAL_INT 

5 

6 

7class TestAnnotationRow: 

8 

9 def test_init(self): 

10 test_row = AnnotationRow(annotation=annotations[0], reporter='test', reporter_email='test@test.com') 

11 i = 0 

12 for key in test_row.columns.keys(): 

13 assert key == HEADERS[i] 

14 i += 1 

15 for val in test_row.columns.values(): 

16 assert val == NULL_VAL_STRING 

17 assert test_row.annotation == annotations[0] 

18 assert test_row.reporter == 'test' 

19 assert test_row.reporter_email == 'test@test.com' 

20 assert test_row.recorded_time.timestamp == \ 

21 TimestampProcessor(test_row.annotation['recorded_timestamp']).timestamp 

22 assert test_row.observation_time.timestamp == \ 

23 TimestampProcessor(test_row.annotation['observation_timestamp']).timestamp 

24 

25 def test_simple_static_data(self): 

26 test_row = AnnotationRow(annotation=annotations[1], reporter='Bingo, Sarah', reporter_email='sarahr6@hawaii.edu') 

27 test_row.set_simple_static_data() 

28 assert test_row.columns['VARSConceptName'] == 'Paralepididae' 

29 assert test_row.columns['TrackingID'] == '0d9133d7-1d49-47d5-4b6d-6e4fb25dd41e' 

30 assert test_row.columns['AphiaID'] == NULL_VAL_INT 

31 assert test_row.columns['IdentifiedBy'] == 'Putts, Meagan' 

32 assert test_row.columns['IdentificationDate'] == test_row.observation_time.timestamp.strftime('%Y-%m-%d') 

33 assert test_row.columns['IdentificationVerificationStatus'] == 1 

34 assert test_row.columns['DepthMethod'] == 'reported' 

35 assert test_row.columns['ObservationDate'] == test_row.recorded_time.timestamp.strftime('%Y-%m-%d') 

36 assert test_row.columns['ObservationTime'] == test_row.recorded_time.timestamp.strftime('%H:%M:%S') 

37 assert test_row.columns['OtherData'] == 'CTD' 

38 # skip checking 'Modified' column (initialized to current time) 

39 assert test_row.columns['Reporter'] == 'Bingo, Sarah' 

40 assert test_row.columns['ReporterEmail'] == 'sarahr6@hawaii.edu' 

41 assert test_row.columns['EntryDate'] == '' 

42 assert test_row.columns['SampleAreaInSquareMeters'] == NULL_VAL_INT 

43 assert test_row.columns['Density'] == NULL_VAL_INT 

44 assert test_row.columns['Cover'] == NULL_VAL_INT 

45 assert test_row.columns['WeightInKg'] == NULL_VAL_INT 

46 assert test_row.columns['SampleAreaInSquareMeters'] == NULL_VAL_INT 

47 assert test_row.columns['Density'] == NULL_VAL_INT 

48 assert test_row.columns['WeightInKg'] == NULL_VAL_INT 

49 

50 def test_set_ancillary_data(self): 

51 test_row = AnnotationRow(annotation=annotations[1], reporter='test', reporter_email='test') 

52 warnings = [] 

53 test_row.set_ancillary_data(warnings) 

54 assert test_row.columns['Latitude'] == round(38.793148973388, 8) 

55 assert test_row.columns['Longitude'] == round(-72.992393976812, 8) 

56 assert test_row.columns['VerbatimLatitude'] == 38.793148973388 

57 assert test_row.columns['VerbatimLongitude'] == -72.992393976812 

58 assert warnings == [] 

59 

60 def test_set_ancillary_data_missing_location(self): 

61 test_row = AnnotationRow(annotation=annotations[0], reporter='test', reporter_email='test') 

62 warnings = [] 

63 test_row.set_ancillary_data(warnings) 

64 assert test_row.columns['Latitude'] == NULL_VAL_INT 

65 assert test_row.columns['Longitude'] == NULL_VAL_INT 

66 assert test_row.columns['VerbatimLatitude'] == NULL_VAL_INT 

67 assert test_row.columns['VerbatimLongitude'] == NULL_VAL_INT 

68 assert len(warnings) == 1 

69 

70 def test_set_ancillary_data_missing_data(self): 

71 test_row = AnnotationRow(annotation=annotations[5], reporter='test', reporter_email='test') 

72 warnings = [] 

73 test_row.set_ancillary_data(warnings) 

74 assert len(warnings) == 1 

75 

76 def test_set_sample_id(self): 

77 test_row = AnnotationRow(annotation=annotations[1], reporter='test', reporter_email='test') 

78 test_row.set_sample_id('my test dive :)') 

79 assert test_row.columns['SampleID'] == 'my_test_dive_:)_' + test_row.recorded_time.get_formatted_timestamp() 

80 

81 def test_set_dive_info(self): 

82 test_row = AnnotationRow(annotation=annotations[1], reporter='test', reporter_email='test') 

83 test_row.set_dive_info(dive_dict) 

84 assert test_row.columns['Citation'] == '' 

85 assert test_row.columns['Repository'] == \ 

86 'Ocean Exploration Trust | University of Hawaii Deep-sea Animal Research Center' 

87 assert test_row.columns['Locality'] == \ 

88 'Papah_naumoku_kea Marine National Monument (PMNM) | Northwestern Hawaiian Islands | Unnamed Seamount A' 

89 assert test_row.columns['Ocean'] == 'North Pacific' 

90 assert test_row.columns['LargeMarineEcosystem'] == 'Insular Pacific-Hawaiian' 

91 assert test_row.columns['Country'] == 'USA' 

92 assert test_row.columns['FishCouncilRegion'] == 'Western Pacific' 

93 assert test_row.columns['SurveyID'] == 'NA134' 

94 assert test_row.columns['Vessel'] == 'Nautilus' 

95 assert test_row.columns['PI'] == 'Kelley, Christopher; Kosaki, Randy; Orcutt, Beth; Petruncio, Emil' 

96 assert test_row.columns['PIAffiliation'] == 'NA' 

97 assert test_row.columns['Purpose'] == 'Document whether these underwater mountains support vibrant coral ' \ 

98 'and sponge communities like others in the region' 

99 assert test_row.columns['Station'] == 'NA134-H1884' 

100 assert test_row.columns['EventID'] == 'NA134-H1884' 

101 assert test_row.columns['SamplingEquipment'] == 'ROV' 

102 assert test_row.columns['VehicleName'] == 'Hercules' 

103 assert test_row.columns['LocationAccuracy'] == '50m' 

104 assert test_row.columns['NavType'] == 'USBL' 

105 assert test_row.columns['WebSite'] == 'https://nautiluslive.org/cruise/na134' 

106 assert test_row.columns['DataProvider'] == 'Ocean Exploration Trust; University of Hawaiʻi' 

107 assert test_row.columns['DataContact'] == 'Bingo, Sarah; sarahr6@hawaii.edu' 

108 

109 def test_set_concept_info_no_descriptors(self): 

110 test_row = AnnotationRow(annotation=annotations[1], reporter='test', reporter_email='test') 

111 test_row.set_concept_info(concepts, warning_messages=[]) 

112 assert test_row.columns['ScientificName'] == 'Paralepididae' 

113 assert test_row.columns['VernacularName'] == 'barracudinas' 

114 assert test_row.columns['TaxonRank'] == 'Family' 

115 assert test_row.columns['AphiaID'] == 125447 

116 assert test_row.columns['LifeScienceIdentifier'] == 'urn:lsid:marinespecies.org:taxname:125447' 

117 assert test_row.columns['Kingdom'] == 'Animalia' 

118 assert test_row.columns['Phylum'] == 'Chordata' 

119 assert test_row.columns['Class'] == 'Teleostei' 

120 assert test_row.columns['Subclass'] == NULL_VAL_STRING 

121 assert test_row.columns['Order'] == 'Aulopiformes' 

122 assert test_row.columns['Suborder'] == NULL_VAL_STRING 

123 assert test_row.columns['Family'] == 'Paralepididae' 

124 assert test_row.columns['Subfamily'] == NULL_VAL_STRING 

125 assert test_row.columns['Genus'] == NULL_VAL_STRING 

126 assert test_row.columns['Subgenus'] == NULL_VAL_STRING 

127 assert test_row.columns['Species'] == NULL_VAL_STRING 

128 assert test_row.columns['Subspecies'] == NULL_VAL_STRING 

129 assert test_row.columns['ScientificNameAuthorship'] == 'Bonaparte, 1835' 

130 assert test_row.columns['CombinedNameID'] == 'Paralepididae' 

131 assert test_row.columns['Morphospecies'] == NULL_VAL_STRING 

132 assert test_row.columns['Synonyms'] == NULL_VAL_STRING 

133 

134 def test_set_concept_info_descriptors(self): 

135 test_row = AnnotationRow(annotation=annotations[3], reporter='test', reporter_email='test') 

136 test_row.set_concept_info(concepts, warning_messages=[]) 

137 assert test_row.columns['ScientificName'] == 'Demospongiae' 

138 assert test_row.columns['VernacularName'] == 'demosponges | horny sponges' 

139 assert test_row.columns['TaxonRank'] == 'Class' 

140 assert test_row.columns['AphiaID'] == 164811 

141 assert test_row.columns['LifeScienceIdentifier'] == 'urn:lsid:marinespecies.org:taxname:164811' 

142 assert test_row.columns['Kingdom'] == 'Animalia' 

143 assert test_row.columns['Phylum'] == 'Porifera' 

144 assert test_row.columns['Class'] == 'Demospongiae' 

145 assert test_row.columns['Subclass'] == NULL_VAL_STRING 

146 assert test_row.columns['Order'] == NULL_VAL_STRING 

147 assert test_row.columns['Suborder'] == NULL_VAL_STRING 

148 assert test_row.columns['Family'] == NULL_VAL_STRING 

149 assert test_row.columns['Subfamily'] == NULL_VAL_STRING 

150 assert test_row.columns['Genus'] == NULL_VAL_STRING 

151 assert test_row.columns['Subgenus'] == NULL_VAL_STRING 

152 assert test_row.columns['Species'] == NULL_VAL_STRING 

153 assert test_row.columns['Subspecies'] == NULL_VAL_STRING 

154 assert test_row.columns['ScientificNameAuthorship'] == 'Sollas, 1885' 

155 assert test_row.columns['CombinedNameID'] == 'Demospongiae encrusting' 

156 assert test_row.columns['Morphospecies'] == 'encrusting' 

157 assert test_row.columns['Synonyms'] == 'hehe | test' 

158 

159 def test_set_media_type(self): 

160 test_row = AnnotationRow(annotation=annotations[1], reporter='test', reporter_email='test') 

161 test_row.columns['ScientificName'] = 'this was a triumph' 

162 test_row.set_media_type('im making a note here, huge success') # it's hard to overstate my satisfaction 

163 assert test_row.columns['RecordType'] == 'im making a note here, huge success' 

164 assert test_row.columns['IdentificationQualifier'] == 'ID by expert from image' 

165 

166 def test_set_media_type_no_name(self): 

167 test_row = AnnotationRow(annotation=annotations[4], reporter='test', reporter_email='test') 

168 test_row.set_media_type('still image') 

169 assert test_row.columns['RecordType'] == 'still image' 

170 assert test_row.columns['IdentificationQualifier'] == NULL_VAL_STRING 

171 

172 def test_set_id_comments_maybe(self): 

173 test_row = AnnotationRow(annotation=annotations[2], reporter='test', reporter_email='test') 

174 test_row.columns['ScientificName'] = 'test' 

175 test_row.columns['IdentificationQualifier'] = 'ID by expert from taste' 

176 test_row.set_id_comments() 

177 assert test_row.columns['IdentificationQualifier'] == 'ID by expert from taste | ID Uncertain' 

178 assert test_row.columns['IdentificationComments'] == NULL_VAL_STRING 

179 

180 def test_set_id_comments_other(self): 

181 test_row = AnnotationRow(annotation=annotations[6], reporter='test', reporter_email='test') 

182 test_row.columns['ScientificName'] = 'test' 

183 test_row.columns['IdentificationQualifier'] = 'ID by expert from smell' 

184 test_row.set_id_comments() 

185 assert test_row.columns['IdentificationQualifier'] == 'ID by expert from smell' 

186 assert test_row.columns['IdentificationComments'] == 'small head | long ribbon body' 

187 

188 def test_set_id_comments_none(self): 

189 test_row = AnnotationRow(annotation=annotations[4], reporter='test', reporter_email='test') 

190 test_row.set_id_comments() 

191 assert test_row.columns['IdentificationQualifier'] == NULL_VAL_STRING 

192 assert test_row.columns['IdentificationComments'] == NULL_VAL_STRING 

193 

194 def test_set_indv_count(self): 

195 test_row = AnnotationRow(annotation=annotations[5], reporter='test', reporter_email='test') 

196 test_row.set_indv_count_and_cat_abundance() 

197 assert test_row.columns['IndividualCount'] == '2' 

198 assert test_row.columns['CategoricalAbundance'] == NULL_VAL_STRING 

199 

200 def test_set_cat_abundance(self): 

201 test_row = AnnotationRow(annotation=annotations[7], reporter='test', reporter_email='test') 

202 test_row.set_indv_count_and_cat_abundance() 

203 assert test_row.columns['IndividualCount'] == NULL_VAL_INT 

204 assert test_row.columns['CategoricalAbundance'] == '\u003e100' 

205 

206 def test_set_indv_count_and_cat_abundance_none(self): 

207 test_row = AnnotationRow(annotation=annotations[4], reporter='test', reporter_email='test') 

208 test_row.set_indv_count_and_cat_abundance() 

209 assert test_row.columns['IndividualCount'] == NULL_VAL_INT 

210 assert test_row.columns['CategoricalAbundance'] == NULL_VAL_STRING 

211 

212 def test_set_size(self): 

213 warnings = [] 

214 test_row = AnnotationRow(annotation=annotations[8], reporter='test', reporter_email='test') 

215 test_row.set_size(warnings) 

216 assert test_row.columns['VerbatimSize'] == '50-100 cm' 

217 assert test_row.columns['MinimumSize'] == '50' 

218 assert test_row.columns['MaximumSize'] == '100' 

219 assert warnings == [] 

220 

221 def test_set_size_no_size(self): 

222 warnings = [] 

223 test_row = AnnotationRow(annotation=annotations[4], reporter='test', reporter_email='test') 

224 test_row.set_size(warnings) 

225 assert test_row.columns['VerbatimSize'] == NULL_VAL_STRING 

226 assert test_row.columns['MinimumSize'] == NULL_VAL_INT 

227 assert test_row.columns['MaximumSize'] == NULL_VAL_INT 

228 assert warnings == [] 

229 

230 def test_set_size_no_match(self): 

231 warnings = [] 

232 test_row = AnnotationRow(annotation=annotations[7], reporter='test', reporter_email='test') 

233 test_row.set_size(warnings) 

234 assert test_row.columns['VerbatimSize'] == '51000000 cm' 

235 assert test_row.columns['MinimumSize'] == NULL_VAL_INT 

236 assert test_row.columns['MaximumSize'] == NULL_VAL_INT 

237 assert len(warnings) == 1 

238 

239 def test_set_condition_comment(self): 

240 warnings = [] 

241 test_row = AnnotationRow(annotation=annotations[1], reporter='test', reporter_email='test') 

242 test_row.columns['ScientificName'] = 'Magikarp' 

243 test_row.set_condition_comment(warnings) 

244 assert test_row.columns['Condition'] == 'Live' 

245 assert warnings == [] 

246 

247 def test_set_condition_comment_none(self): 

248 warnings = [] 

249 test_row = AnnotationRow(annotation=annotations[1], reporter='test', reporter_email='test') 

250 test_row.set_condition_comment(warnings) 

251 assert test_row.columns['Condition'] == NULL_VAL_STRING 

252 assert warnings == [] 

253 

254 def test_set_condition_comment_damaged(self): 

255 warnings = [] 

256 test_row = AnnotationRow(annotation=annotations[7], reporter='test', reporter_email='test') 

257 test_row.set_condition_comment(warnings) 

258 assert test_row.columns['Condition'] == 'Damaged' 

259 assert warnings == [] 

260 

261 def test_set_condition_comment_dead(self): 

262 warnings = [] 

263 test_row = AnnotationRow(annotation=annotations[8], reporter='test', reporter_email='test') 

264 test_row.set_condition_comment(warnings) 

265 assert test_row.columns['Condition'] == 'Dead' 

266 assert len(warnings) == 1 

267 

268 def test_set_comments_simple_remark(self): 

269 test_row = AnnotationRow(annotation=annotations[6], reporter='test', reporter_email='test') 

270 test_row.set_comments_and_sample() 

271 assert test_row.columns['OccurrenceComments'] == 'in water column on descent' 

272 

273 def test_set_comments_simple_size(self): 

274 warnings = [] 

275 test_row = AnnotationRow(annotation=annotations[8], reporter='test', reporter_email='test') 

276 test_row.set_size(warnings) 

277 test_row.set_comments_and_sample() 

278 assert test_row.columns['OccurrenceComments'] == 'size is estimated greatest length of individual in cm. Size estimations placed into size category bins' 

279 

280 def test_set_comments_simple_sample(self): 

281 test_row = AnnotationRow(annotation=annotations[9], reporter='test', reporter_email='test') 

282 test_row.columns['TrackingID'] = '1234' 

283 test_row.set_comments_and_sample() 

284 assert test_row.columns['OccurrenceComments'] == 'sampled by manipulator' 

285 assert test_row.columns['TrackingID'] == '1234 | NA134-158-B-MCZ' 

286 

287 def test_set_comments_and_sample_none(self): 

288 test_row = AnnotationRow(annotation=annotations[2], reporter='test', reporter_email='test') 

289 test_row.set_comments_and_sample() 

290 assert test_row.columns['OccurrenceComments'] == NULL_VAL_STRING 

291 

292 def test_set_comments_and_sample(self): 

293 warnings = [] 

294 test_row = AnnotationRow(annotation=annotations[1], reporter='test', reporter_email='test') 

295 test_row.set_size(warnings) 

296 test_row.set_comments_and_sample() 

297 assert test_row.columns['OccurrenceComments'] == \ 

298 'in water column on descent | another remark | size is estimated greatest length of individual in cm. ' \ 

299 'Size estimations placed into size category bins | comment: loose talus | sampled by manipulator' 

300 

301 def test_set_comments_old_vars(self): 

302 warnings = [] 

303 test_row = AnnotationRow(annotation=annotations[10], reporter='test', reporter_email='test') 

304 test_row.set_size(warnings) 

305 test_row.set_comments_and_sample() 

306 assert test_row.columns['OccurrenceComments'] == 'notes: 363;; | comment: karstic' 

307 

308 def test_set_cmecs_geo(self): 

309 test_row = AnnotationRow(annotation=annotations[1], reporter='test', reporter_email='test') 

310 test_row.set_cmecs_geo('get out of my swamp') 

311 assert test_row.columns['CMECSGeoForm'] == 'get out of my swamp' 

312 

313 def test_set_habitat_s1(self): 

314 warnings = [] 

315 test_row = AnnotationRow(annotation=annotations[5], reporter='test', reporter_email='test') 

316 test_row.set_habitat(warnings) 

317 assert test_row.columns['Habitat'] == 'primarily: sediment' 

318 assert warnings == [] 

319 

320 def test_set_habitat_s1_none(self): 

321 warnings = [] 

322 test_row = AnnotationRow(annotation=annotations[6], reporter='test', reporter_email='test') 

323 test_row.columns['ScientificName'] = 'Gyarados' 

324 test_row.set_habitat(warnings) 

325 assert test_row.columns['Habitat'] == NULL_VAL_STRING 

326 assert len(warnings) == 1 

327 

328 def test_set_habitat_s1_fail(self): 

329 warnings = [] 

330 test_row = AnnotationRow(annotation=annotations[8], reporter='test', reporter_email='test') 

331 test_row.set_habitat(warnings) 

332 assert NULL_VAL_STRING in test_row.columns['Habitat'] 

333 assert len(warnings) == 1 

334 

335 def test_set_habitat_one_s2(self): 

336 warnings = [] 

337 test_row = AnnotationRow(annotation=annotations[3], reporter='test', reporter_email='test') 

338 test_row.set_habitat(warnings) 

339 assert test_row.columns['Habitat'] == 'primarily: bedrock / secondary: sediment' 

340 assert warnings == [] 

341 

342 def test_set_habitat_multiple_s2(self): 

343 warnings = [] 

344 test_row = AnnotationRow(annotation=annotations[2], reporter='test', reporter_email='test') 

345 test_row.set_habitat(warnings) 

346 assert test_row.columns['Habitat'] == 'primarily: sediment / secondary: boulder; bedrock' 

347 assert warnings == [] 

348 

349 def test_set_habitat_s2_fail(self): 

350 warnings = [] 

351 test_row = AnnotationRow(annotation=annotations[8], reporter='test', reporter_email='test') 

352 test_row.set_habitat(warnings) 

353 assert NULL_VAL_STRING in test_row.columns['Habitat'] 

354 assert len(warnings) == 1 

355 

356 def test_set_habitat_comment(self): 

357 warnings = [] 

358 test_row = AnnotationRow(annotation=annotations[1], reporter='test', reporter_email='test') 

359 test_row.set_habitat(warnings) 

360 print(f'"{test_row.columns["Habitat"]}"') 

361 print('"primarily: sediment / secondary: man-made trash / comments: loose talus"') 

362 assert test_row.columns['Habitat'] == 'primarily: sediment / secondary: man-made trash / comments: loose talus' 

363 assert warnings == [] 

364 

365 def test_set_upon_not_creature(self): 

366 test_row = AnnotationRow(annotation=annotations[0], reporter='test', reporter_email='test') 

367 test_row.set_upon() 

368 assert test_row.columns['UponIsCreature'] is False 

369 assert test_row.columns['Substrate'] == 'sediment' 

370 

371 def test_set_upon_is_creature(self): 

372 test_row = AnnotationRow(annotation=annotations[9], reporter='test', reporter_email='test') 

373 test_row.set_upon() 

374 assert test_row.columns['UponIsCreature'] is True 

375 assert test_row.columns['Substrate'] == 'some creature' 

376 

377 def test_set_upon_no_upon(self): 

378 test_row = AnnotationRow(annotation=annotations[1], reporter='test', reporter_email='test') 

379 test_row.set_upon() 

380 assert test_row.columns['UponIsCreature'] is False 

381 assert test_row.columns['Substrate'] == NULL_VAL_STRING 

382 

383 def test_set_id_ref(self): 

384 warnings = [] 

385 test_row = AnnotationRow(annotation=annotations[9], reporter='test', reporter_email='test') 

386 test_row.set_id_ref(warnings) 

387 assert test_row.columns['IdentityReference'] == 51 

388 assert len(warnings) == 0 

389 

390 def test_set_id_ref_none(self): 

391 warnings = [] 

392 test_row = AnnotationRow(annotation=annotations[1], reporter='test', reporter_email='test') 

393 test_row.set_id_ref(warnings) 

394 assert test_row.columns['IdentityReference'] == -1 

395 assert len(warnings) == 0 

396 

397 def test_set_id_ref_blank(self): 

398 warnings = [] 

399 test_row = AnnotationRow(annotation=annotations[10], reporter='test', reporter_email='test') 

400 test_row.set_id_ref(warnings) 

401 assert test_row.columns['IdentityReference'] == -1 

402 assert len(warnings) == 1 

403 

404 def test_set_depth(self): 

405 test_row = AnnotationRow(annotation=annotations[0], reporter='test', reporter_email='test') 

406 warnings = [] 

407 test_row.set_depth(warnings) 

408 assert test_row.columns['DepthInMeters'] == round(668.458984375, 4) 

409 assert test_row.columns['MinimumDepthInMeters'] == 668.459 

410 assert test_row.columns['MaximumDepthInMeters'] == 668.459 

411 assert warnings == [] 

412 

413 def test_set_depth_missing(self): 

414 test_row = AnnotationRow(annotation=annotations[2], reporter='test', reporter_email='test') 

415 warnings = [] 

416 test_row.set_depth(warnings) 

417 assert test_row.columns['DepthInMeters'] == NULL_VAL_INT 

418 assert test_row.columns['MinimumDepthInMeters'] == NULL_VAL_INT 

419 assert test_row.columns['MaximumDepthInMeters'] == NULL_VAL_INT 

420 assert len(warnings) == 1 

421 

422 def test_set_temperature(self): 

423 warnings = [] 

424 test_row = AnnotationRow(annotation=annotations[1], reporter='test', reporter_email='test') 

425 test_row.set_temperature(warnings) 

426 assert test_row.columns['Temperature'] == 5.126 

427 assert warnings == [] 

428 

429 def test_set_temperature_none(self): 

430 warnings = [] 

431 test_row = AnnotationRow(annotation=annotations[4], reporter='test', reporter_email='test') 

432 test_row.set_temperature(warnings) 

433 assert test_row.columns['Temperature'] == NULL_VAL_INT 

434 assert len(warnings) == 1 

435 

436 def test_set_salinity(self): 

437 warnings = [] 

438 test_row = AnnotationRow(annotation=annotations[1], reporter='test', reporter_email='test') 

439 test_row.set_salinity(warnings) 

440 assert test_row.columns['Salinity'] == 35.8649 

441 assert warnings == [] 

442 

443 def test_set_salinity_none(self): 

444 warnings = [] 

445 test_row = AnnotationRow(annotation=annotations[4], reporter='test', reporter_email='test') 

446 test_row.set_salinity(warnings) 

447 assert test_row.columns['Salinity'] == NULL_VAL_INT 

448 assert len(warnings) == 1 

449 

450 def test_set_oxygen(self): 

451 warnings = [] 

452 test_row = AnnotationRow(annotation=annotations[1], reporter='test', reporter_email='test') 

453 test_row.set_oxygen(warnings) 

454 assert test_row.columns['Oxygen'] == 7.3196 

455 assert warnings == [] 

456 

457 def test_set_oxygen_none(self): 

458 warnings = [] 

459 test_row = AnnotationRow(annotation=annotations[4], reporter='test', reporter_email='test') 

460 test_row.set_oxygen(warnings) 

461 assert test_row.columns['Oxygen'] == NULL_VAL_INT 

462 assert len(warnings) == 1 

463 

464 def test_set_image_paths_one_no_hl(self): 

465 test_row = AnnotationRow(annotation=annotations[7], reporter='test', reporter_email='test') 

466 test_row.set_image_paths(download_highlight_images=False, output_file_path='', warning_messages=[]) 

467 assert test_row.columns['ImageFilePath'] == 'https://hurlimage.soest.hawaii.edu/SupplementalPhotos/Hphotos/NA134photos/H1895/cam1_20211130090725.png' 

468 assert test_row.columns['HighlightImageFilePath'] == NULL_VAL_STRING 

469 

470 def test_set_image_paths_one_hl_best(self): 

471 test_row = AnnotationRow(annotation=annotations[6], reporter='test', reporter_email='test') 

472 test_row.set_image_paths(download_highlight_images=False, output_file_path='', warning_messages=[]) 

473 assert test_row.columns['ImageFilePath'] == 'https://hurlimage.soest.hawaii.edu/SupplementalPhotos/D2photos/EX1404photos/EX1404L2_DIVE01_20140905/EX1404L2_IMG_20140905T135040Z_ROVHD_NICE_EEL_BOTTOM.png' 

474 assert test_row.columns['HighlightImageFilePath'] == 'https://hurlimage.soest.hawaii.edu/SupplementalPhotos/D2photos/EX1404photos/EX1404L2_DIVE01_20140905/EX1404L2_IMG_20140905T135040Z_ROVHD_NICE_EEL_BOTTOM.png' 

475 

476 def test_set_image_paths_one_hl_dense(self): 

477 test_row = AnnotationRow(annotation=annotations[8], reporter='test', reporter_email='test') 

478 test_row.set_image_paths(download_highlight_images=False, output_file_path='', warning_messages=[]) 

479 assert test_row.columns['ImageFilePath'] == 'https://hurlimage.soest.hawaii.edu/SupplementalPhotos/Hphotos/NA134photos/H1895/cam1_20211130080700.png' 

480 assert test_row.columns['HighlightImageFilePath'] == 'https://hurlimage.soest.hawaii.edu/SupplementalPhotos/Hphotos/NA134photos/H1895/cam1_20211130080700.png' 

481 

482 def test_set_image_paths_multiple(self): 

483 test_row = AnnotationRow(annotation=annotations[9], reporter='test', reporter_email='test') 

484 test_row.set_image_paths(download_highlight_images=False, output_file_path='', warning_messages=[]) 

485 assert test_row.columns['ImageFilePath'] == 'https://hurlimage.soest.hawaii.edu/SupplementalPhotos/Hphotos/NA134photos/H1895/cam1_20211130145709.png' 

486 assert test_row.columns['HighlightImageFilePath'] == NULL_VAL_STRING 

487 

488 def test_old_vars_image_paths(self): 

489 test_row = AnnotationRow(annotation=annotations[10], reporter='test', reporter_email='test') 

490 test_row.set_image_paths(download_highlight_images=False, output_file_path='', warning_messages=[]) 

491 assert test_row.columns['ImageFilePath'] == 'https://hurlimage.soest.hawaii.edu/SupplementalPhotos/P5photos/P5-653/P5-653-042.tif | https://hurlimage.soest.hawaii.edu/SupplementalPhotos/P5photos/P5-653/P5-653-d3-13238a1.tif | https://hurlimage.soest.hawaii.edu/SupplementalPhotos/P5photos/P5-653/P5-653-d3-13238a2.tif' 

492 assert test_row.columns['HighlightImageFilePath'] == NULL_VAL_STRING 

493 

494 def test_set_bounding_box_uuid_single(self): 

495 test_row = AnnotationRow(annotation=annotations[0], reporter='test', reporter_email='test') 

496 test_row.set_bounding_box_uuid() 

497 assert test_row.columns['BoundingBoxID'] == 'b860c165-078e-4715-8bc3-491039679b67' 

498 

499 def test_set_bounding_box_uuid_none(self): 

500 test_row = AnnotationRow(annotation=annotations[1], reporter='test', reporter_email='test') 

501 test_row.set_bounding_box_uuid() 

502 assert test_row.columns['BoundingBoxID'] == NULL_VAL_STRING