Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions test/unit/test_experimental.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import time
from datetime import datetime

import pytest
Expand Down Expand Up @@ -106,6 +107,25 @@ def test_counting_detector(gl_experimental: ExperimentalApi):
assert count_iq.result.count is not None


def test_counting_detector_async(gl_experimental: ExperimentalApi):
"""
verify that we can create and submit to a counting detector
"""
name = f"Test {datetime.utcnow()}"
created_detector = gl_experimental.create_counting_detector(name, "How many dogs", "dog")
assert created_detector is not None
async_iq = gl_experimental.ask_async(created_detector, "test/assets/dog.jpeg")
# attempting to access fields within the result should raise an exception
with pytest.raises(AttributeError):
_ = async_iq.result.label # type: ignore
with pytest.raises(AttributeError):
_ = async_iq.result.confidence # type: ignore
time.sleep(5)
# you should be able to get a "real" result by retrieving an updated image query object from the server
_image_query = gl_experimental.get_image_query(id=async_iq.id)
assert _image_query.result is not None


@pytest.mark.skip(
reason=(
"General users currently currently can't use multiclass detectors. If you have questions, reach out"
Expand Down