|
25 | 25 | from labelbox.schema.data_row import DataRowMetadataField
|
26 | 26 | from labelbox.schema.ontology_kind import OntologyKind
|
27 | 27 | from labelbox.schema.user import User
|
| 28 | +from labelbox.schema.tool_building.types import FeatureSchemaAttribute |
28 | 29 |
|
29 | 30 |
|
30 | 31 | @pytest.fixture
|
@@ -552,6 +553,76 @@ def point():
|
552 | 553 | )
|
553 | 554 |
|
554 | 555 |
|
| 556 | +@pytest.fixture |
| 557 | +def auto_ocr_text_value_class(): |
| 558 | + return Classification( |
| 559 | + class_type=Classification.Type.TEXT, |
| 560 | + name="Auto OCR Text Value", |
| 561 | + instructions="Text value for ocr bboxes", |
| 562 | + scope=Classification.Scope.GLOBAL, |
| 563 | + required=False, |
| 564 | + attributes=[ |
| 565 | + FeatureSchemaAttribute( |
| 566 | + attributeName="auto-ocr-text-value", attributeValue="true" |
| 567 | + ) |
| 568 | + ], |
| 569 | + ) |
| 570 | + |
| 571 | + |
| 572 | +@pytest.fixture |
| 573 | +def auto_ocr_bbox(auto_ocr_text_value_class): |
| 574 | + return Tool( |
| 575 | + tool=Tool.Type.BBOX, |
| 576 | + name="Auto ocr bbox", |
| 577 | + color="ff0000", |
| 578 | + attributes=[ |
| 579 | + FeatureSchemaAttribute( |
| 580 | + attributeName="auto-ocr", attributeValue="true" |
| 581 | + ) |
| 582 | + ], |
| 583 | + classifications=[auto_ocr_text_value_class], |
| 584 | + ) |
| 585 | + |
| 586 | + |
| 587 | +@pytest.fixture |
| 588 | +def requires_connection_classification(): |
| 589 | + return Classification( |
| 590 | + name="Requires connection radio", |
| 591 | + instructions="Classification that requires a connection", |
| 592 | + class_type=Classification.Type.RADIO, |
| 593 | + attributes=[ |
| 594 | + FeatureSchemaAttribute( |
| 595 | + attributeName="requires-connection", attributeValue="true" |
| 596 | + ) |
| 597 | + ], |
| 598 | + options=[Option(value="A"), Option(value="B")], |
| 599 | + ) |
| 600 | + |
| 601 | + |
| 602 | +@pytest.fixture |
| 603 | +def requires_connection_classification_feature_schema( |
| 604 | + client, requires_connection_classification |
| 605 | +): |
| 606 | + created_feature_schema = client.upsert_feature_schema( |
| 607 | + requires_connection_classification.asdict() |
| 608 | + ) |
| 609 | + yield created_feature_schema |
| 610 | + client.delete_unused_feature_schema( |
| 611 | + created_feature_schema.normalized["featureSchemaId"] |
| 612 | + ) |
| 613 | + |
| 614 | + |
| 615 | +@pytest.fixture |
| 616 | +def auto_ocr_bbox_feature_schema(client, auto_ocr_bbox): |
| 617 | + created_feature_schema = client.upsert_feature_schema( |
| 618 | + auto_ocr_bbox.asdict() |
| 619 | + ) |
| 620 | + yield created_feature_schema |
| 621 | + client.delete_unused_feature_schema( |
| 622 | + created_feature_schema.normalized["featureSchemaId"] |
| 623 | + ) |
| 624 | + |
| 625 | + |
555 | 626 | @pytest.fixture
|
556 | 627 | def feature_schema(client, point):
|
557 | 628 | created_feature_schema = client.upsert_feature_schema(point.asdict())
|
|
0 commit comments