Skip to content

Commit e454204

Browse files
author
Val Brodsky
committed
Fix tests
1 parent bf3b7c8 commit e454204

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

libs/labelbox/src/labelbox/schema/internal/data_row_upsert_item.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
from labelbox.pydantic_compat import BaseModel
66
from labelbox.schema.identifiable import UniqueId, GlobalKey
77
from labelbox import pydantic_compat
8+
from labelbox.schema.data_row import DataRow
89

910

1011
class DataRowItemBase(ABC, pydantic_compat.BaseModel):
@@ -78,7 +79,8 @@ def is_empty(self) -> bool:
7879
or the only key is `dataset_id`.
7980
:return: bool
8081
"""
81-
row_data = self.payload.get("row_data", None)
82+
row_data = self.payload.get("row_data", None) or self.payload.get(
83+
DataRow.row_data, None)
8284
return (not self.payload or len(self.payload.keys()) == 1 and
8385
"dataset_id" in self.payload or row_data is None or
8486
len(row_data) == 0)

libs/labelbox/tests/unit/test_data_row_upsert_data.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
from labelbox.schema.asset_attachment import AttachmentType
88
from labelbox.schema.dataset import Dataset
99
from labelbox.schema.internal.descriptor_file_creator import DescriptorFileCreator
10+
from labelbox.schema.data_row import DataRow
1011

1112

1213
@pytest.fixture
@@ -119,6 +120,11 @@ def test_create_is_empty():
119120
id={}, payload={"row_data": "http://my_site.com/photos/img_01.jpg"})
120121
assert not item.is_empty()
121122

123+
item = DataRowCreateItem(
124+
id={},
125+
payload={DataRow.row_data: "http://my_site.com/photos/img_01.jpg"})
126+
assert not item.is_empty()
127+
122128

123129
def test_create_row_data_none():
124130
items = [

0 commit comments

Comments
 (0)