Skip to content

Commit 9760126

Browse files
author
gdj0nes
committed
Format and use test dir
1 parent 89a9b00 commit 9760126

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
lines changed

labelbox/schema/project.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -463,12 +463,14 @@ def dequeue(self, data_row_ids: List[str]):
463463

464464
def _post_batch(self, method, data_row_ids: List[str]):
465465
"""Post batch methods"""
466-
466+
467467
if self.queue_mode() != QueueMode.Batch:
468468
raise ValueError("Project must be in batch mode")
469469

470470
if len(data_row_ids) > MAX_QUEUE_BATCH_SIZE:
471-
raise ValueError(f"Batch exceeds max size of {MAX_QUEUE_BATCH_SIZE}, consider breaking it into parts")
471+
raise ValueError(
472+
f"Batch exceeds max size of {MAX_QUEUE_BATCH_SIZE}, consider breaking it into parts"
473+
)
472474

473475
query = """mutation %sPyApi($projectId: ID!, $dataRowIds: [ID!]!) {
474476
project(where: {id: $projectId}) {

tests/data/annotation_types/data/test_text.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import os
2+
13
import pytest
24
from pydantic import ValidationError
35

@@ -22,11 +24,13 @@ def test_url():
2224
assert len(text) == 3541
2325

2426

25-
def test_file():
26-
file_path = "tests/data/assets/sample_text.txt"
27-
text_data = TextData(file_path=file_path)
28-
text = text_data.value
29-
assert len(text) == 3541
27+
def test_file(tmpdir):
28+
content = "foo bar baz"
29+
file = "hello.txt"
30+
dir = tmpdir.mkdir('data')
31+
dir.join(file).write(content)
32+
text_data = TextData(file_path=os.path.join(dir.strpath, file))
33+
assert len(text_data.value) == len(content)
3034

3135

3236
def test_ref():

0 commit comments

Comments
 (0)