diff --git a/CHANGELOG.md b/CHANGELOG.md index 28cacfeba..3bf435ffc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Changelog +# Version 0.0.0 (YYYY-MM-DD) - In Progress + +### Changed +* Update QueueMode enum to support new value for QueueMode.Batch = `BATCH`. + # Version 3.27.2 (2022-10-04) ### Added diff --git a/labelbox/schema/queue_mode.py b/labelbox/schema/queue_mode.py index 355e982c5..333e92987 100644 --- a/labelbox/schema/queue_mode.py +++ b/labelbox/schema/queue_mode.py @@ -2,5 +2,11 @@ class QueueMode(str, Enum): - Batch = "CATALOG" + Batch = "BATCH" Dataset = "DATA_SET" + + @classmethod + def _missing_(cls, value): + # Parses the deprecated "CATALOG" value back to QueueMode.Batch. + if value == "CATALOG": + return QueueMode.Batch diff --git a/tests/unit/test_queue_mode.py b/tests/unit/test_queue_mode.py new file mode 100644 index 000000000..a07b14a54 --- /dev/null +++ b/tests/unit/test_queue_mode.py @@ -0,0 +1,20 @@ +import pytest + +from labelbox.schema.queue_mode import QueueMode + + +def test_parse_deprecated_catalog(): + assert QueueMode("CATALOG") == QueueMode.Batch + + +def test_parse_batch(): + assert QueueMode("BATCH") == QueueMode.Batch + + +def test_parse_data_set(): + assert QueueMode("DATA_SET") == QueueMode.Dataset + + +def test_fails_for_unknown(): + with pytest.raises(ValueError): + QueueMode("foo")