PyLD 2.0.4__tar.gz → 3.0.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. {PyLD-2.0.4 → pyld-3.0.0}/CHANGELOG.md +42 -0
  2. pyld-3.0.0/LICENSE +26 -0
  3. {PyLD-2.0.4/lib/PyLD.egg-info → pyld-3.0.0}/PKG-INFO +118 -13
  4. {PyLD-2.0.4 → pyld-3.0.0}/README.rst +104 -11
  5. {PyLD-2.0.4 → pyld-3.0.0}/README.txt +104 -11
  6. {PyLD-2.0.4 → pyld-3.0.0/lib/PyLD.egg-info}/PKG-INFO +118 -13
  7. {PyLD-2.0.4 → pyld-3.0.0}/lib/PyLD.egg-info/SOURCES.txt +11 -1
  8. pyld-3.0.0/lib/pyld/__about__.py +7 -0
  9. {PyLD-2.0.4 → pyld-3.0.0}/lib/pyld/__init__.py +2 -1
  10. pyld-3.0.0/lib/pyld/canon.py +566 -0
  11. {PyLD-2.0.4 → pyld-3.0.0}/lib/pyld/context_resolver.py +50 -32
  12. {PyLD-2.0.4 → pyld-3.0.0}/lib/pyld/documentloader/aiohttp.py +66 -28
  13. {PyLD-2.0.4 → pyld-3.0.0}/lib/pyld/documentloader/requests.py +17 -14
  14. pyld-3.0.0/lib/pyld/identifier_issuer.py +53 -0
  15. pyld-3.0.0/lib/pyld/iri_resolver.py +319 -0
  16. {PyLD-2.0.4 → pyld-3.0.0}/lib/pyld/jsonld.py +1813 -2036
  17. pyld-3.0.0/lib/pyld/nquads.py +244 -0
  18. {PyLD-2.0.4 → pyld-3.0.0}/lib/pyld/resolved_context.py +2 -0
  19. pyld-3.0.0/pyproject.toml +57 -0
  20. {PyLD-2.0.4 → pyld-3.0.0}/setup.py +1 -0
  21. pyld-3.0.0/tests/test_document_loader.py +84 -0
  22. pyld-3.0.0/tests/test_iri_resolver.py +508 -0
  23. pyld-3.0.0/tests/test_jsonld.py +571 -0
  24. pyld-3.0.0/tests/test_manifests.py +32 -0
  25. pyld-3.0.0/tests/test_nquads.py +231 -0
  26. PyLD-2.0.4/LICENSE +0 -44
  27. PyLD-2.0.4/lib/pyld/__about__.py +0 -9
  28. {PyLD-2.0.4 → pyld-3.0.0}/MANIFEST.in +0 -0
  29. {PyLD-2.0.4 → pyld-3.0.0}/lib/PyLD.egg-info/dependency_links.txt +0 -0
  30. {PyLD-2.0.4 → pyld-3.0.0}/lib/PyLD.egg-info/requires.txt +0 -0
  31. {PyLD-2.0.4 → pyld-3.0.0}/lib/PyLD.egg-info/top_level.txt +0 -0
  32. {PyLD-2.0.4 → pyld-3.0.0}/lib/c14n/Canonicalize.py +0 -0
  33. {PyLD-2.0.4 → pyld-3.0.0}/lib/c14n/NumberToJson.py +0 -0
  34. {PyLD-2.0.4 → pyld-3.0.0}/lib/c14n/__init__.py +0 -0
  35. {PyLD-2.0.4 → pyld-3.0.0}/lib/pyld/documentloader/__init__.py +0 -0
  36. {PyLD-2.0.4 → pyld-3.0.0}/setup.cfg +0 -0
@@ -1,5 +1,47 @@
1
1
  # pyld ChangeLog
2
2
 
3
+ ## 3.0.0 - 2026-04-02
4
+
5
+ ### Changed
6
+ - **BREAKING**: Require supported Python version >= 3.10.
7
+ - Update aiohttp document loader to work with Python 3.14.
8
+ - Minimize async related changes to library code in this release.
9
+ - In sync environment use `asyncio.run`.
10
+ - In async environment use background thread.
11
+ - The default test manifests or directories now default to the
12
+ `./specifications` directory.
13
+ - Add ability to run test suites using pytest and make pytest the default way
14
+ for running (unit)tests.
15
+ - The functionality to resolve relative IRIs to absolute IRIs has been moved
16
+ from `context_resolver.py` to `iri_resolver.py` so it can be maintained
17
+ and tested separately.
18
+ - Migrate the `prepend_base(base, iri)` function to the `resolve(iri, base)`
19
+ function.
20
+ - Move the existing function `remove_dot_segments(path)` and update the
21
+ implementation.
22
+ - Migrate the `remove_base(base, iri)` function to the `unresolve(iri, base)`
23
+ function and update the implementation to use stdlib `urllib.parse` and
24
+ `urllib.unparse` to replace the custom implementation.
25
+ - Update code to use `resolve(iri, base)` and `unresolve(iri, base)` instead.
26
+ Invalid base IRIs (including `None`) are no longer allowed, hence missing
27
+ base IRIs in the JSON-LD context are now handled outside the function call.
28
+ - Add unittests
29
+ - **BREAKING**: the custom `cause` and `traceback` attributes on `JsonLdError`
30
+ are replaced by Python [exception chaining](https://peps.python.org/pep-3134/)
31
+ and the built-in `__cause__` attribute.
32
+ - **BREAKING**: The `IdentifierIssuer` class was moved to `identifier_issuer.py`.
33
+ It's now available at `pyld.identifier_issuer`.
34
+ - **BREAKING**: The classes `URDNA2015` and `URGNA2012` were moved to `canon.py`.
35
+ They are now available at `pyld.canon`.
36
+ - `jsonld.expand()` now accepts a `on_property_dropped` parameter which is a handler
37
+ called on every ignored JSON property.
38
+ - **BREAKING**: In cases where there is no document base (for instance, when
39
+ using a string as input), 'http://example.org/base/' is used as the base IRI
40
+ when `@base` is absent or explicitely set to `null`.
41
+ - **BREAKING**: Some internal parameters were renamed from camelCase to pythonic:
42
+ - `requestProfile` to `request_profile` in `load_document()`
43
+ - `rdfDirection` to `rdf_direction` in `_list_to_rdf()` and `_object_to_rdf()`
44
+
3
45
  ## 2.0.4 - 2024-02-16
4
46
 
5
47
  ### Fixed
pyld-3.0.0/LICENSE ADDED
@@ -0,0 +1,26 @@
1
+ Copyright (c) 2011-2025 Digital Bazaar, Inc.
2
+
3
+ Redistribution and use in source and binary forms, with or without modification,
4
+ are permitted provided that the following conditions are met:
5
+
6
+ 1. Redistributions of source code must retain the above copyright notice, this
7
+ list of conditions and the following disclaimer.
8
+
9
+ 2. Redistributions in binary form must reproduce the above copyright notice,
10
+ this list of conditions and the following disclaimer in the documentation and/or
11
+ other materials provided with the distribution.
12
+
13
+ 3. Neither the name of the copyright holder nor the names of its contributors
14
+ may be used to endorse or promote products derived from this software without
15
+ specific prior written permission.
16
+
17
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
21
+ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
24
+ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: PyLD
3
- Version: 2.0.4
3
+ Version: 3.0.0
4
4
  Summary: Python implementation of the JSON-LD API
5
5
  Home-page: https://github.com/digitalbazaar/pyld
6
6
  Author: Digital Bazaar
@@ -15,6 +15,7 @@ Classifier: Operating System :: OS Independent
15
15
  Classifier: Programming Language :: Python
16
16
  Classifier: Topic :: Internet
17
17
  Classifier: Topic :: Software Development :: Libraries
18
+ Description-Content-Type: text/x-rst
18
19
  License-File: LICENSE
19
20
  Requires-Dist: cachetools
20
21
  Requires-Dist: frozendict
@@ -27,6 +28,17 @@ Provides-Extra: cachetools
27
28
  Requires-Dist: cachetools; extra == "cachetools"
28
29
  Provides-Extra: frozendict
29
30
  Requires-Dist: frozendict; extra == "frozendict"
31
+ Dynamic: author
32
+ Dynamic: author-email
33
+ Dynamic: classifier
34
+ Dynamic: description
35
+ Dynamic: description-content-type
36
+ Dynamic: home-page
37
+ Dynamic: license
38
+ Dynamic: license-file
39
+ Dynamic: provides-extra
40
+ Dynamic: requires-dist
41
+ Dynamic: summary
30
42
 
31
43
  PyLD
32
44
  ====
@@ -89,7 +101,7 @@ yet supported.
89
101
  Requirements
90
102
  ------------
91
103
 
92
- - Python_ (3.6 or later)
104
+ - Python_ (3.10 or later)
93
105
  - Requests_ (optional)
94
106
  - aiohttp_ (optional, Python 3.5 or later)
95
107
 
@@ -200,6 +212,23 @@ If Requests_ is not available, the loader is set to aiohttp_. The fallback
200
212
  document loader is a dummy document loader that raises an exception on every
201
213
  invocation.
202
214
 
215
+ Handling ignored properties during JSON-LD expansion
216
+ ----------------------------------------------------
217
+
218
+ If a property in a JSON-LD document does not map to an absolute IRI then it is
219
+ ignored. You can customize this behaviour by passing a customizable handler to
220
+ `on_property_dropped` parameter of `jsonld.expand()`.
221
+
222
+ For example, you can introduce a strict mode by raising a ValueError on every
223
+ dropped property:
224
+
225
+ .. code-block:: Python
226
+
227
+ def raise_this(value):
228
+ raise ValueError(value)
229
+
230
+ jsonld.expand(doc, None, on_property_dropped=raise_this)
231
+
203
232
  Commercial Support
204
233
  ------------------
205
234
 
@@ -220,24 +249,92 @@ Tests
220
249
  This library includes a sample testing utility which may be used to verify
221
250
  that changes to the processor maintain the correct output.
222
251
 
223
- To run the sample tests you will need to get the test suite files by cloning
252
+ To run the sample tests you will need to get the test suite files, which
253
+ by default, are stored in the `specifications/` folder.
254
+ The test suites can be obtained by either using git submodules or by cloning
255
+ them manually.
256
+
257
+ Using git submodules
258
+ ####################
259
+
260
+ The test suites are included as git submodules to ensure versions are in sync.
261
+ When cloning the repository, use the ``--recurse-submodules`` flag to
262
+ automatically clone the submodules.
263
+ If you have cloned the repository without the submodules, you can initialize
264
+ them with the following commands:
265
+
266
+ .. code-block:: bash
267
+
268
+ git submodule init
269
+ git submodule update
270
+
271
+ Cloning manually
272
+ ####################
273
+
274
+ You can also avoid using git submodules by manually cloning
224
275
  the ``json-ld-api``, ``json-ld-framing``, and ``normalization`` repositories
225
- hosted on GitHub:
276
+ hosted on GitHub using the following commands:
277
+
278
+ .. code-block:: bash
279
+
280
+ git clone https://github.com/w3c/json-ld-api ./specifications/json-ld-api
281
+ git clone https://github.com/w3c/json-ld-framing ./specifications/json-ld-framing
282
+ git clone https://github.com/json-ld/normalization ./specifications/normalization
283
+
284
+ Note that you can clone these repositories into any location you wish; however,
285
+ if you do not clone them into the default ``specifications/`` folder, you will
286
+ need to provide the paths to the test runner as arguments when running the
287
+ tests, as explained below
288
+
289
+ Running the sample test suites and unittests using pytest
290
+ #########################################################
291
+
292
+ If the suites repositories are available in the `specifications/` folder of the
293
+ PyLD source directory, then all unittests, including the sample test suites,
294
+ can be run with `pytest`:
226
295
 
227
- - https://github.com/w3c/json-ld-api
228
- - https://github.com/w3c/json-ld-framing
229
- - https://github.com/json-ld/normalization
296
+ .. code-block:: bash
297
+
298
+ pytest
299
+
300
+ If you wish to store the test suites in a different location than the default
301
+ ``specifications/`` folder, or you want to test individual manifest ``.jsonld``
302
+ files or directories containing a ``manifest.jsonld``, then you can supply
303
+ these files or directories as arguments:
304
+
305
+ .. code-block:: bash
306
+
307
+ # use: pytest --tests=TEST_PATH [--tests=TEST_PATH...]
308
+ pytest --tests=./specifications/json-ld-api/tests
309
+
310
+ The test runner supports different document loaders by setting
311
+ ``--loader requests`` or ``--loader aiohttp``. The default document loader is
312
+ set to Requests_.
313
+
314
+ .. code-block:: bash
315
+
316
+ pytest --loader=requests --tests=./specifications/json-ld-api/tests
317
+
318
+ An EARL report can be generated using the ``--earl`` option.
230
319
 
231
- If the suites repositories are available as sibling directories of the PyLD
232
- source directory, then all the tests can be run with the following:
320
+ .. code-block:: bash
321
+
322
+ pytest --earl=./earl-report.json
323
+
324
+ Running the sample test suites using the original test runner
325
+ #############################################################
326
+
327
+ You can also run the JSON-LD test suites using the original test runner script
328
+ provided:
233
329
 
234
330
  .. code-block:: bash
235
331
 
236
332
  python tests/runtests.py
237
333
 
238
- If you want to test individual manifest ``.jsonld`` files or directories
239
- containing a ``manifest.jsonld``, then you can supply these files or
240
- directories as arguments:
334
+ If you wish to store the test suites in a different location than the default
335
+ ``specifications/`` folder, or you want to test individual manifest ``.jsonld``
336
+ files or directories containing a ``manifest.jsonld``, then you can supply
337
+ these files or directories as arguments:
241
338
 
242
339
  .. code-block:: bash
243
340
 
@@ -246,8 +343,16 @@ directories as arguments:
246
343
  The test runner supports different document loaders by setting ``-l requests``
247
344
  or ``-l aiohttp``. The default document loader is set to Requests_.
248
345
 
346
+ .. code-block:: bash
347
+
348
+ python tests/runtests.py -l requests ./specifications/json-ld-api/tests
349
+
249
350
  An EARL report can be generated using the ``-e`` or ``--earl`` option.
250
351
 
352
+ .. code-block:: bash
353
+
354
+ python tests/runtests.py -e ./earl-report.json
355
+
251
356
 
252
357
  .. _Digital Bazaar: https://digitalbazaar.com/
253
358
 
@@ -59,7 +59,7 @@ yet supported.
59
59
  Requirements
60
60
  ------------
61
61
 
62
- - Python_ (3.6 or later)
62
+ - Python_ (3.10 or later)
63
63
  - Requests_ (optional)
64
64
  - aiohttp_ (optional, Python 3.5 or later)
65
65
 
@@ -170,6 +170,23 @@ If Requests_ is not available, the loader is set to aiohttp_. The fallback
170
170
  document loader is a dummy document loader that raises an exception on every
171
171
  invocation.
172
172
 
173
+ Handling ignored properties during JSON-LD expansion
174
+ ----------------------------------------------------
175
+
176
+ If a property in a JSON-LD document does not map to an absolute IRI then it is
177
+ ignored. You can customize this behaviour by passing a customizable handler to
178
+ `on_property_dropped` parameter of `jsonld.expand()`.
179
+
180
+ For example, you can introduce a strict mode by raising a ValueError on every
181
+ dropped property:
182
+
183
+ .. code-block:: Python
184
+
185
+ def raise_this(value):
186
+ raise ValueError(value)
187
+
188
+ jsonld.expand(doc, None, on_property_dropped=raise_this)
189
+
173
190
  Commercial Support
174
191
  ------------------
175
192
 
@@ -190,24 +207,92 @@ Tests
190
207
  This library includes a sample testing utility which may be used to verify
191
208
  that changes to the processor maintain the correct output.
192
209
 
193
- To run the sample tests you will need to get the test suite files by cloning
210
+ To run the sample tests you will need to get the test suite files, which
211
+ by default, are stored in the `specifications/` folder.
212
+ The test suites can be obtained by either using git submodules or by cloning
213
+ them manually.
214
+
215
+ Using git submodules
216
+ ####################
217
+
218
+ The test suites are included as git submodules to ensure versions are in sync.
219
+ When cloning the repository, use the ``--recurse-submodules`` flag to
220
+ automatically clone the submodules.
221
+ If you have cloned the repository without the submodules, you can initialize
222
+ them with the following commands:
223
+
224
+ .. code-block:: bash
225
+
226
+ git submodule init
227
+ git submodule update
228
+
229
+ Cloning manually
230
+ ####################
231
+
232
+ You can also avoid using git submodules by manually cloning
194
233
  the ``json-ld-api``, ``json-ld-framing``, and ``normalization`` repositories
195
- hosted on GitHub:
234
+ hosted on GitHub using the following commands:
235
+
236
+ .. code-block:: bash
237
+
238
+ git clone https://github.com/w3c/json-ld-api ./specifications/json-ld-api
239
+ git clone https://github.com/w3c/json-ld-framing ./specifications/json-ld-framing
240
+ git clone https://github.com/json-ld/normalization ./specifications/normalization
241
+
242
+ Note that you can clone these repositories into any location you wish; however,
243
+ if you do not clone them into the default ``specifications/`` folder, you will
244
+ need to provide the paths to the test runner as arguments when running the
245
+ tests, as explained below
246
+
247
+ Running the sample test suites and unittests using pytest
248
+ #########################################################
249
+
250
+ If the suites repositories are available in the `specifications/` folder of the
251
+ PyLD source directory, then all unittests, including the sample test suites,
252
+ can be run with `pytest`:
196
253
 
197
- - https://github.com/w3c/json-ld-api
198
- - https://github.com/w3c/json-ld-framing
199
- - https://github.com/json-ld/normalization
254
+ .. code-block:: bash
255
+
256
+ pytest
257
+
258
+ If you wish to store the test suites in a different location than the default
259
+ ``specifications/`` folder, or you want to test individual manifest ``.jsonld``
260
+ files or directories containing a ``manifest.jsonld``, then you can supply
261
+ these files or directories as arguments:
262
+
263
+ .. code-block:: bash
264
+
265
+ # use: pytest --tests=TEST_PATH [--tests=TEST_PATH...]
266
+ pytest --tests=./specifications/json-ld-api/tests
267
+
268
+ The test runner supports different document loaders by setting
269
+ ``--loader requests`` or ``--loader aiohttp``. The default document loader is
270
+ set to Requests_.
271
+
272
+ .. code-block:: bash
273
+
274
+ pytest --loader=requests --tests=./specifications/json-ld-api/tests
275
+
276
+ An EARL report can be generated using the ``--earl`` option.
200
277
 
201
- If the suites repositories are available as sibling directories of the PyLD
202
- source directory, then all the tests can be run with the following:
278
+ .. code-block:: bash
279
+
280
+ pytest --earl=./earl-report.json
281
+
282
+ Running the sample test suites using the original test runner
283
+ #############################################################
284
+
285
+ You can also run the JSON-LD test suites using the original test runner script
286
+ provided:
203
287
 
204
288
  .. code-block:: bash
205
289
 
206
290
  python tests/runtests.py
207
291
 
208
- If you want to test individual manifest ``.jsonld`` files or directories
209
- containing a ``manifest.jsonld``, then you can supply these files or
210
- directories as arguments:
292
+ If you wish to store the test suites in a different location than the default
293
+ ``specifications/`` folder, or you want to test individual manifest ``.jsonld``
294
+ files or directories containing a ``manifest.jsonld``, then you can supply
295
+ these files or directories as arguments:
211
296
 
212
297
  .. code-block:: bash
213
298
 
@@ -216,8 +301,16 @@ directories as arguments:
216
301
  The test runner supports different document loaders by setting ``-l requests``
217
302
  or ``-l aiohttp``. The default document loader is set to Requests_.
218
303
 
304
+ .. code-block:: bash
305
+
306
+ python tests/runtests.py -l requests ./specifications/json-ld-api/tests
307
+
219
308
  An EARL report can be generated using the ``-e`` or ``--earl`` option.
220
309
 
310
+ .. code-block:: bash
311
+
312
+ python tests/runtests.py -e ./earl-report.json
313
+
221
314
 
222
315
  .. _Digital Bazaar: https://digitalbazaar.com/
223
316
 
@@ -59,7 +59,7 @@ yet supported.
59
59
  Requirements
60
60
  ------------
61
61
 
62
- - Python_ (3.6 or later)
62
+ - Python_ (3.10 or later)
63
63
  - Requests_ (optional)
64
64
  - aiohttp_ (optional, Python 3.5 or later)
65
65
 
@@ -170,6 +170,23 @@ If Requests_ is not available, the loader is set to aiohttp_. The fallback
170
170
  document loader is a dummy document loader that raises an exception on every
171
171
  invocation.
172
172
 
173
+ Handling ignored properties during JSON-LD expansion
174
+ ----------------------------------------------------
175
+
176
+ If a property in a JSON-LD document does not map to an absolute IRI then it is
177
+ ignored. You can customize this behaviour by passing a customizable handler to
178
+ `on_property_dropped` parameter of `jsonld.expand()`.
179
+
180
+ For example, you can introduce a strict mode by raising a ValueError on every
181
+ dropped property:
182
+
183
+ .. code-block:: Python
184
+
185
+ def raise_this(value):
186
+ raise ValueError(value)
187
+
188
+ jsonld.expand(doc, None, on_property_dropped=raise_this)
189
+
173
190
  Commercial Support
174
191
  ------------------
175
192
 
@@ -190,24 +207,92 @@ Tests
190
207
  This library includes a sample testing utility which may be used to verify
191
208
  that changes to the processor maintain the correct output.
192
209
 
193
- To run the sample tests you will need to get the test suite files by cloning
210
+ To run the sample tests you will need to get the test suite files, which
211
+ by default, are stored in the `specifications/` folder.
212
+ The test suites can be obtained by either using git submodules or by cloning
213
+ them manually.
214
+
215
+ Using git submodules
216
+ ####################
217
+
218
+ The test suites are included as git submodules to ensure versions are in sync.
219
+ When cloning the repository, use the ``--recurse-submodules`` flag to
220
+ automatically clone the submodules.
221
+ If you have cloned the repository without the submodules, you can initialize
222
+ them with the following commands:
223
+
224
+ .. code-block:: bash
225
+
226
+ git submodule init
227
+ git submodule update
228
+
229
+ Cloning manually
230
+ ####################
231
+
232
+ You can also avoid using git submodules by manually cloning
194
233
  the ``json-ld-api``, ``json-ld-framing``, and ``normalization`` repositories
195
- hosted on GitHub:
234
+ hosted on GitHub using the following commands:
235
+
236
+ .. code-block:: bash
237
+
238
+ git clone https://github.com/w3c/json-ld-api ./specifications/json-ld-api
239
+ git clone https://github.com/w3c/json-ld-framing ./specifications/json-ld-framing
240
+ git clone https://github.com/json-ld/normalization ./specifications/normalization
241
+
242
+ Note that you can clone these repositories into any location you wish; however,
243
+ if you do not clone them into the default ``specifications/`` folder, you will
244
+ need to provide the paths to the test runner as arguments when running the
245
+ tests, as explained below
246
+
247
+ Running the sample test suites and unittests using pytest
248
+ #########################################################
249
+
250
+ If the suites repositories are available in the `specifications/` folder of the
251
+ PyLD source directory, then all unittests, including the sample test suites,
252
+ can be run with `pytest`:
196
253
 
197
- - https://github.com/w3c/json-ld-api
198
- - https://github.com/w3c/json-ld-framing
199
- - https://github.com/json-ld/normalization
254
+ .. code-block:: bash
255
+
256
+ pytest
257
+
258
+ If you wish to store the test suites in a different location than the default
259
+ ``specifications/`` folder, or you want to test individual manifest ``.jsonld``
260
+ files or directories containing a ``manifest.jsonld``, then you can supply
261
+ these files or directories as arguments:
262
+
263
+ .. code-block:: bash
264
+
265
+ # use: pytest --tests=TEST_PATH [--tests=TEST_PATH...]
266
+ pytest --tests=./specifications/json-ld-api/tests
267
+
268
+ The test runner supports different document loaders by setting
269
+ ``--loader requests`` or ``--loader aiohttp``. The default document loader is
270
+ set to Requests_.
271
+
272
+ .. code-block:: bash
273
+
274
+ pytest --loader=requests --tests=./specifications/json-ld-api/tests
275
+
276
+ An EARL report can be generated using the ``--earl`` option.
200
277
 
201
- If the suites repositories are available as sibling directories of the PyLD
202
- source directory, then all the tests can be run with the following:
278
+ .. code-block:: bash
279
+
280
+ pytest --earl=./earl-report.json
281
+
282
+ Running the sample test suites using the original test runner
283
+ #############################################################
284
+
285
+ You can also run the JSON-LD test suites using the original test runner script
286
+ provided:
203
287
 
204
288
  .. code-block:: bash
205
289
 
206
290
  python tests/runtests.py
207
291
 
208
- If you want to test individual manifest ``.jsonld`` files or directories
209
- containing a ``manifest.jsonld``, then you can supply these files or
210
- directories as arguments:
292
+ If you wish to store the test suites in a different location than the default
293
+ ``specifications/`` folder, or you want to test individual manifest ``.jsonld``
294
+ files or directories containing a ``manifest.jsonld``, then you can supply
295
+ these files or directories as arguments:
211
296
 
212
297
  .. code-block:: bash
213
298
 
@@ -216,8 +301,16 @@ directories as arguments:
216
301
  The test runner supports different document loaders by setting ``-l requests``
217
302
  or ``-l aiohttp``. The default document loader is set to Requests_.
218
303
 
304
+ .. code-block:: bash
305
+
306
+ python tests/runtests.py -l requests ./specifications/json-ld-api/tests
307
+
219
308
  An EARL report can be generated using the ``-e`` or ``--earl`` option.
220
309
 
310
+ .. code-block:: bash
311
+
312
+ python tests/runtests.py -e ./earl-report.json
313
+
221
314
 
222
315
  .. _Digital Bazaar: https://digitalbazaar.com/
223
316