Skip to content

Commit 610286d

Browse files
committed
update to test cases
1 parent 333b84c commit 610286d

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

labelbox/schema/ontology.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ def from_dict(cls, dictionary: Dict[str, Any]) -> Dict[str, Any]:
157157
options=[Option.from_dict(o) for o in dictionary["options"]],
158158
schema_id=dictionary.get("schemaNodeId", None),
159159
feature_schema_id=dictionary.get("featureSchemaId", None),
160-
scope=dictionary.get("scope", cls.Scope.GLOBAL))
160+
scope=cls.Scope(dictionary.get("scope", cls.Scope.GLOBAL)))
161161

162162
def asdict(self) -> Dict[str, Any]:
163163
if self.class_type in self._REQUIRES_OPTIONS \

tests/unit/test_unit_ontology.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@
4646
"nested classification",
4747
"type":
4848
"radio",
49+
"scope":
50+
"global",
4951
"options": [{
5052
"schemaNodeId":
5153
None,
@@ -62,6 +64,7 @@
6264
"instructions": "nested nested text",
6365
"name": "nested nested text",
6466
"type": "text",
67+
"scope": "global",
6568
"options": []
6669
}]
6770
}, {
@@ -78,6 +81,7 @@
7881
"instructions": "nested text",
7982
"name": "nested text",
8083
"type": "text",
84+
"scope": "global",
8185
"options": []
8286
}]
8387
}, {
@@ -118,6 +122,8 @@
118122
"This is a question.",
119123
"type":
120124
"radio",
125+
"scope":
126+
"global",
121127
"options": [{
122128
"schemaNodeId": None,
123129
"featureSchemaId": None,
@@ -244,5 +250,6 @@ def test_option_add_option() -> None:
244250

245251

246252
def test_ontology_asdict() -> None:
253+
print(OntologyBuilder.from_dict(_SAMPLE_ONTOLOGY))
247254
assert OntologyBuilder.from_dict(
248255
_SAMPLE_ONTOLOGY).asdict() == _SAMPLE_ONTOLOGY

0 commit comments

Comments
 (0)