diff --git a/test/unit/test_experimental.py b/test/unit/test_experimental.py index b0dca6a2..2dacdccc 100644 --- a/test/unit/test_experimental.py +++ b/test/unit/test_experimental.py @@ -1,3 +1,4 @@ +import time from datetime import datetime import pytest @@ -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"