@@ -18,15 +18,16 @@ def test_parse_sharks_coco(self):
1818 parsed = folderparser .parsefolder (sharksfolder )
1919 testImagePath = "/train/sharks_mp4-20_jpg.rf.90ba2e8e9ca0613f71359efb7ed48b26.jpg"
2020 testImage = [i for i in parsed ["images" ] if i ["file" ] == testImagePath ][0 ]
21- assert len (testImage ["annotationfile" ]["parsed" ] ["annotations" ]) == 5
21+ assert len (json . loads ( testImage ["annotationfile" ]["rawText" ]) ["annotations" ]) == 5
2222
2323 def test_parse_sharks_createml (self ):
2424 sharksfolder = f"{ thisdir } /../datasets/sharks-tiny-createml"
2525 parsed = folderparser .parsefolder (sharksfolder )
2626 testImagePath = "/train/sharks_mp4-20_jpg.rf.5359121123e86e016401ea2731e47949.jpg"
2727 testImage = [i for i in parsed ["images" ] if i ["file" ] == testImagePath ][0 ]
28- assert len (testImage ["annotationfile" ]["parsed" ]) == 1
29- imgReference = testImage ["annotationfile" ]["parsed" ][0 ]
28+ imgParsedAnnotations = json .loads (testImage ["annotationfile" ]["rawText" ])
29+ assert len (imgParsedAnnotations ) == 1
30+ imgReference = imgParsedAnnotations [0 ]
3031 assert len (imgReference ["annotations" ]) == 5
3132
3233 def test_parse_sharks_yolov9 (self ):
@@ -44,10 +45,9 @@ def test_parse_mosquitos_csv(self):
4445 testImagePath = "/train_10308.jpeg"
4546 testImage = [i for i in parsed ["images" ] if i ["file" ] == testImagePath ][0 ]
4647 assert testImage ["annotationfile" ]["name" ] == "annotation.csv"
47- headers = testImage ["annotationfile" ]["parsed" ]["headers" ]
48- lines = testImage ["annotationfile" ]["parsed" ]["lines" ]
49- assert headers == "img_fName,img_w,img_h,class_label,bbx_xtl,bbx_ytl,bbx_xbr,bbx_ybr\n "
50- assert lines == ["train_10308.jpeg,1058,943,japonicus/koreicus,28,187,908,815\n " ]
48+ expected = "img_fName,img_w,img_h,class_label,bbx_xtl,bbx_ytl,bbx_xbr,bbx_ybr\n "
49+ expected += "train_10308.jpeg,1058,943,japonicus/koreicus,28,187,908,815\n "
50+ assert testImage ["annotationfile" ]["rawText" ] == expected
5151
5252
5353def _assertJsonMatchesFile (actual , filename ):
0 commit comments