1616
1717See the :doc: `api-reference ` for full usage details.
1818
19- .. invisible-code-block: python
20-
21- import contextlib
22- import pathlib
23- import shutil
24-
25- import vws_test_fixtures
26- from mock_vws import MockVWS
27- from mock_vws.database import VuforiaDatabase
28-
29- mock = MockVWS(real_http=False)
30- database = VuforiaDatabase(
31- server_access_key='[server-access-key]',
32- server_secret_key='[server-secret-key]',
33- client_access_key='[client-access-key]',
34- client_secret_key='[client-secret-key]',
35- )
36- mock.add_database(database=database)
37- stack = contextlib.ExitStack()
38- stack.enter_context(mock)
39-
40- # We rely on implementation details of the fixtures package.
41- image = pathlib.Path(vws_test_fixtures.__path__[0]) / 'high_quality_image.jpg'
42- assert image.exists(), image.resolve()
43- new_image = pathlib.Path('high_quality_image.jpg')
44- shutil.copy(image, new_image)
45-
4619.. code-block :: python
4720
4821 import pathlib
@@ -62,7 +35,8 @@ See the :doc:`api-reference` for full usage details.
6235 client_access_key = client_access_key,
6336 client_secret_key = client_secret_key,
6437 )
65- name = ' my_image_name'
38+ import uuid
39+ name = ' my_image_name' + uuid.uuid4().hex
6640
6741 image = pathlib.Path(' high_quality_image.jpg' )
6842 with image.open(mode = ' rb' ) as my_image_file:
@@ -79,12 +53,6 @@ See the :doc:`api-reference` for full usage details.
7953 assert matching_targets[0 ].target_id == target_id
8054 a = 1
8155
82- .. invisible-code-block: python
83-
84- new_image = pathlib.Path('high_quality_image.jpg')
85- new_image.unlink()
86- stack.close()
87-
8856 Testing
8957-------
9058
@@ -96,19 +64,6 @@ To write unit tests for code which uses this library, without using your Vuforia
9664
9765.. clear-namespace
9866
99- .. invisible-code-block: python
100-
101- import pathlib
102- import shutil
103-
104- import vws_test_fixtures
105-
106- # We rely on implementation details of the fixtures package.
107- image = pathlib.Path(vws_test_fixtures.__path__[0]) / 'high_quality_image.jpg'
108- assert image.exists(), image.resolve()
109- new_image = pathlib.Path('high_quality_image.jpg')
110- shutil.copy(image, new_image)
111-
11267 .. code-block :: python
11368
11469 import pathlib
@@ -129,7 +84,6 @@ To write unit tests for code which uses this library, without using your Vuforia
12984 client_secret_key = database.client_secret_key,
13085 )
13186
132-
13387 image = pathlib.Path(' high_quality_image.jpg' )
13488 with image.open(mode = ' rb' ) as my_image_file:
13589 target_id = vws_client.add_target(
@@ -140,11 +94,6 @@ To write unit tests for code which uses this library, without using your Vuforia
14094 active_flag = True ,
14195 )
14296
143- .. invisible-code-block: python
144-
145- new_image = pathlib.Path('high_quality_image.jpg')
146- new_image.unlink()
147-
14897 There are some differences between the mock and the real Vuforia.
14998See https://vws-python-mock.readthedocs.io/en/latest/differences-to-vws.html for details.
15099
0 commit comments