File tree Expand file tree Collapse file tree 4 files changed +71
-0
lines changed
Expand file tree Collapse file tree 4 files changed +71
-0
lines changed Original file line number Diff line number Diff line change 11"""
22A library for Vuforia Web Services.
33"""
4+
5+ from .vws import VWS
6+
7+ __all__ = [
8+ 'VWS' ,
9+ ]
Original file line number Diff line number Diff line change 1+ """
2+ Common fixtures.
3+ """
Original file line number Diff line number Diff line change 1+ """
2+ Fixtures for images.
3+ """
4+
5+ import io
6+
7+ import pytest
8+
9+
10+ @pytest .fixture ()
11+ def high_quality_image () -> io .BytesIO :
12+ """
13+ Return an image file which is expected to have a 'success' status when
14+ added to a target and a high tracking rating.
15+
16+ At the time of writing, this image gains a tracking rating of 5.
17+ """
18+ path = 'tests/data/high_quality_image.jpg'
19+ with open (path , 'rb' ) as high_quality_image_file :
20+ return io .BytesIO (high_quality_image_file .read ())
Original file line number Diff line number Diff line change 1+ """
2+ Tests for helper function for adding a target to a Vuforia database.
3+ """
4+
5+ import io
6+
7+ from vws import VWS
8+ from vws .exceptions import (
9+ BadImage ,
10+ Fail ,
11+ ImageTooLarge ,
12+ MetadataTooLarge ,
13+ ProjectInactive ,
14+ TargetNameExist ,
15+ )
16+
17+
18+ class TestSuccess :
19+ """
20+ Tests for successfully adding a target.
21+ """
22+
23+ def test_add_target (
24+ self ,
25+ client : VWS ,
26+ high_quality_image : io .BytesIO ,
27+ ) -> None :
28+ """
29+ No exception is raised when adding one target.
30+ """
31+ client .add_target (name = 'x' , width = 1 , image = high_quality_image )
32+
33+ def test_add_two_targets (
34+ self ,
35+ client : VWS ,
36+ high_quality_image : io .BytesIO ,
37+ ) -> None :
38+ """
39+ No exception is raised when adding two targets with different names.
40+ """
41+ client .add_target (name = 'x' , width = 1 , image = high_quality_image )
42+ client .add_target (name = 'a' , width = 1 , image = high_quality_image )
You can’t perform that action at this time.
0 commit comments