-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
108 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -52,5 +52,5 @@ Labelbox Python SDK Documentation | |
task | ||
task-queue | ||
user | ||
user-group-upload | ||
user-group-v2 | ||
webhook |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
User Group | ||
=============================================================================================== | ||
|
||
.. automodule:: labelbox.schema.user_group_v2 | ||
:members: | ||
:show-inheritance: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
from unittest.mock import MagicMock | ||
|
||
import pytest | ||
|
||
from labelbox.schema.user_group_v2 import Member, UserGroupV2 | ||
|
||
|
||
@pytest.fixture | ||
def client(): | ||
return MagicMock() | ||
|
||
|
||
def test_parse_members_csv_empty(client): | ||
group = UserGroupV2(client) | ||
assert group._parse_members_csv("") == [] | ||
assert group._parse_members_csv("\n") == [] | ||
|
||
|
||
def test_parse_members_csv_header_only(client): | ||
group = UserGroupV2(client) | ||
assert group._parse_members_csv("email\n") == [] | ||
|
||
|
||
def test_parse_members_csv_single_member(client): | ||
group = UserGroupV2(client) | ||
result = group._parse_members_csv("email\n[email protected]") | ||
assert len(result) == 1 | ||
assert isinstance(result[0], Member) | ||
assert result[0].email == "[email protected]" | ||
|
||
|
||
def test_parse_members_csv_multiple_members(client): | ||
group = UserGroupV2(client) | ||
csv_data = "email\n[email protected]\n[email protected]\n[email protected]" | ||
result = group._parse_members_csv(csv_data) | ||
assert len(result) == 3 | ||
assert [m.email for m in result] == [ | ||
"[email protected]", | ||
"[email protected]", | ||
"[email protected]", | ||
] | ||
|
||
|
||
def test_parse_members_csv_handles_whitespace(client): | ||
group = UserGroupV2(client) | ||
csv_data = "email\n [email protected] \n\n[email protected]\n" | ||
result = group._parse_members_csv(csv_data) | ||
assert len(result) == 2 | ||
assert result[0].email == "[email protected]" | ||
assert result[1].email == "[email protected]" |