11import time
22
3+ from labelbox import Client
34import pytest
4- import requests
55import os
66
77from labelbox import Label
@@ -29,11 +29,13 @@ def test_labels(configured_project_with_label):
2929
3030
3131# 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" )
32+ @pytest .mark .skipif (
33+ condition = os .environ ["LABELBOX_TEST_ENVIRON" ] == "onprem"
34+ or os .environ ["LABELBOX_TEST_ENVIRON" ] == "staging"
35+ or os .environ ["LABELBOX_TEST_ENVIRON" ] == "local"
36+ or os .environ ["LABELBOX_TEST_ENVIRON" ] == "custom" ,
37+ reason = "does not work for onprem" ,
38+ )
3739def test_label_update (configured_project_with_label ):
3840 _ , _ , _ , label = configured_project_with_label
3941 label .update (label = "something else" )
@@ -57,7 +59,7 @@ def test_label_bulk_deletion(configured_project_with_label):
5759 project , _ , _ , _ = configured_project_with_label
5860
5961 for _ in range (2 ):
60- #only run twice, already have one label in the fixture
62+ # only run twice, already have one label in the fixture
6163 project .create_label ()
6264 labels = project .labels ()
6365 l1 = next (labels )
@@ -74,3 +76,15 @@ def test_label_bulk_deletion(configured_project_with_label):
7476 time .sleep (5 )
7577
7678 assert set (project .labels ()) == {l2 }
79+
80+
81+ def test_upsert_label_scores (configured_project_with_label , client : Client ):
82+ project , _ , _ , _ = configured_project_with_label
83+
84+ label = next (project .labels ())
85+
86+ scores = client .upsert_label_feedback (
87+ label_id = label .uid , feedback = "That's a great label!" , scores = {"overall" : 5 }
88+ )
89+ assert len (scores ) == 1
90+ assert scores [0 ].score == 5
0 commit comments