1+ import os
12import time
23
34import pytest
4- import requests
5- import os
65
7- from labelbox import Label
6+ from labelbox import Client , Label
87
98
109def test_labels (configured_project_with_label ):
@@ -29,11 +28,13 @@ def test_labels(configured_project_with_label):
2928
3029
3130# TODO: Skipping this test in staging due to label not updating
32- @pytest .mark .skipif (condition = os .environ ['LABELBOX_TEST_ENVIRON' ] == "onprem" or
33- os .environ ['LABELBOX_TEST_ENVIRON' ] == "staging" or
34- os .environ ['LABELBOX_TEST_ENVIRON' ] == "local" or
35- os .environ ['LABELBOX_TEST_ENVIRON' ] == "custom" ,
36- reason = "does not work for onprem" )
31+ @pytest .mark .skipif (
32+ condition = os .environ ["LABELBOX_TEST_ENVIRON" ] == "onprem" or
33+ os .environ ["LABELBOX_TEST_ENVIRON" ] == "staging" or
34+ os .environ ["LABELBOX_TEST_ENVIRON" ] == "local" or
35+ os .environ ["LABELBOX_TEST_ENVIRON" ] == "custom" ,
36+ reason = "does not work for onprem" ,
37+ )
3738def test_label_update (configured_project_with_label ):
3839 _ , _ , _ , label = configured_project_with_label
3940 label .update (label = "something else" )
@@ -57,7 +58,7 @@ def test_label_bulk_deletion(configured_project_with_label):
5758 project , _ , _ , _ = configured_project_with_label
5859
5960 for _ in range (2 ):
60- #only run twice, already have one label in the fixture
61+ # only run twice, already have one label in the fixture
6162 project .create_label ()
6263 labels = project .labels ()
6364 l1 = next (labels )
@@ -74,3 +75,15 @@ def test_label_bulk_deletion(configured_project_with_label):
7475 time .sleep (5 )
7576
7677 assert set (project .labels ()) == {l2 }
78+
79+
80+ def test_upsert_label_scores (configured_project_with_label , client : Client ):
81+ project , _ , _ , _ = configured_project_with_label
82+
83+ label = next (project .labels ())
84+
85+ scores = client .upsert_label_feedback (label_id = label .uid ,
86+ feedback = "That's a great label!" ,
87+ scores = {"overall" : 5 })
88+ assert len (scores ) == 1
89+ assert scores [0 ].score == 5
0 commit comments