Skip to content

Commit 7d7384b

Browse files
committed
Add tests
1 parent e1ee13e commit 7d7384b

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed

tests/test_validators.py

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2050,3 +2050,49 @@ def test_validate_vector_empty_annotation(self):
20502050
data = json.loads(f.read())
20512051
validator = AnnotationValidators.get_validator("vector")(data)
20522052
self.assertTrue(validator.is_valid())
2053+
2054+
2055+
def test_validate_pixel_annotation_instance_without_class_name(self):
2056+
with tempfile.TemporaryDirectory() as tmpdir_name:
2057+
with open(f"{tmpdir_name}/pixel.json", "w") as pix_json:
2058+
pix_json.write(
2059+
'''
2060+
{
2061+
"metadata": {
2062+
"name": "example_image_1.jpg",
2063+
"lastAction": {
2064+
"email": "shab.prog@gmail.com",
2065+
"timestamp": 1637306216
2066+
}
2067+
},
2068+
"instances": [
2069+
{
2070+
"creationType": "Preannotation",
2071+
"classId": 887060,
2072+
"visible": true,
2073+
"probability": 100,
2074+
"attributes": [
2075+
{
2076+
"id": 1223660,
2077+
"groupId": 358141,
2078+
"name": "no",
2079+
"groupName": "small"
2080+
}
2081+
],
2082+
"parts": [
2083+
{
2084+
"color": "#000447"
2085+
}
2086+
]
2087+
}
2088+
],
2089+
"tags": [],
2090+
"comments": []
2091+
}
2092+
'''
2093+
)
2094+
2095+
with open(f"{tmpdir_name}/pixel.json", "r") as f:
2096+
data = json.loads(f.read())
2097+
validator = AnnotationValidators.get_validator("pixel")(data)
2098+
self.assertTrue(validator.is_valid())

0 commit comments

Comments
 (0)