jsonstat-validator 0.1.0__py3-none-any.whl → 0.1.2__py3-none-any.whl
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.
- jsonstat_validator/__init__.py +6 -4
- jsonstat_validator/validator.py +160 -19
- {jsonstat_validator-0.1.0.dist-info → jsonstat_validator-0.1.2.dist-info}/METADATA +85 -97
- jsonstat_validator-0.1.2.dist-info/RECORD +7 -0
- jsonstat_validator/tests/__init__.py +0 -1
- jsonstat_validator/tests/conftest.py +0 -10
- jsonstat_validator/tests/custom_tests.py +0 -411
- jsonstat_validator/tests/samples/areas/canada.json +0 -16
- jsonstat_validator/tests/samples/areas/galicia.json +0 -16
- jsonstat_validator/tests/samples/areas/index.json +0 -31
- jsonstat_validator/tests/samples/areas/oecd.json +0 -16
- jsonstat_validator/tests/samples/areas/us.json +0 -26
- jsonstat_validator/tests/samples/canada.json +0 -131
- jsonstat_validator/tests/samples/datasets/index.json +0 -51
- jsonstat_validator/tests/samples/galicia.json +0 -124
- jsonstat_validator/tests/samples/hierarchy.json +0 -200
- jsonstat_validator/tests/samples/index.json +0 -36
- jsonstat_validator/tests/samples/metrics/gdp/gsp.json +0 -16
- jsonstat_validator/tests/samples/metrics/gdp/gsppc.json +0 -16
- jsonstat_validator/tests/samples/metrics/gdp/gspw.json +0 -16
- jsonstat_validator/tests/samples/metrics/gdp/index.json +0 -26
- jsonstat_validator/tests/samples/metrics/index.json +0 -26
- jsonstat_validator/tests/samples/metrics/lfs/employed.json +0 -16
- jsonstat_validator/tests/samples/metrics/lfs/index.json +0 -31
- jsonstat_validator/tests/samples/metrics/lfs/lf.json +0 -16
- jsonstat_validator/tests/samples/metrics/lfs/unemployed.json +0 -16
- jsonstat_validator/tests/samples/metrics/lfs/unr.json +0 -21
- jsonstat_validator/tests/samples/metrics/pop/index.json +0 -21
- jsonstat_validator/tests/samples/metrics/pop/pop.json +0 -26
- jsonstat_validator/tests/samples/metrics/pop/popw.json +0 -16
- jsonstat_validator/tests/samples/oecd.json +0 -170
- jsonstat_validator/tests/samples/order.json +0 -38
- jsonstat_validator/tests/samples/sources/bls.json +0 -21
- jsonstat_validator/tests/samples/sources/ige.json +0 -16
- jsonstat_validator/tests/samples/sources/index.json +0 -41
- jsonstat_validator/tests/samples/sources/jsonstat.json +0 -21
- jsonstat_validator/tests/samples/sources/oecd.json +0 -16
- jsonstat_validator/tests/samples/sources/statcan.json +0 -16
- jsonstat_validator/tests/samples/sources/wikipedia.json +0 -16
- jsonstat_validator/tests/samples/topics/accounts.json +0 -16
- jsonstat_validator/tests/samples/topics/demos.json +0 -21
- jsonstat_validator/tests/samples/topics/index.json +0 -31
- jsonstat_validator/tests/samples/topics/labor.json +0 -26
- jsonstat_validator/tests/samples/topics/population.json +0 -26
- jsonstat_validator/tests/samples/us-gsp.json +0 -230
- jsonstat_validator/tests/samples/us-labor.json +0 -6509
- jsonstat_validator/tests/samples/us-unr.json +0 -3269
- jsonstat_validator/tests/test_official_samples.py +0 -51
- jsonstat_validator-0.1.0.dist-info/RECORD +0 -51
- {jsonstat_validator-0.1.0.dist-info → jsonstat_validator-0.1.2.dist-info}/LICENSE +0 -0
- {jsonstat_validator-0.1.0.dist-info → jsonstat_validator-0.1.2.dist-info}/WHEEL +0 -0
- {jsonstat_validator-0.1.0.dist-info → jsonstat_validator-0.1.2.dist-info}/top_level.txt +0 -0
@@ -1,51 +0,0 @@
|
|
1
|
-
"""
|
2
|
-
Test the official JSON-stat samples and collections.
|
3
|
-
|
4
|
-
This test suite validates the official JSON-stat samples provided by the JSON-stat
|
5
|
-
website: https://json-stat.org/samples/. For efficiency purposes, all sample-files
|
6
|
-
are downloaded and saved in the jsonstat_validator/tests/samples directory.
|
7
|
-
"""
|
8
|
-
|
9
|
-
import glob
|
10
|
-
import json
|
11
|
-
from pathlib import Path
|
12
|
-
|
13
|
-
import pytest
|
14
|
-
|
15
|
-
from jsonstat_validator import validate_jsonstat
|
16
|
-
|
17
|
-
# Get the path to the samples directory
|
18
|
-
TESTS_DIR = Path(__file__).parent
|
19
|
-
SAMPLES_DIR = TESTS_DIR / "samples"
|
20
|
-
|
21
|
-
# Find all JSON files in the samples directory
|
22
|
-
official_samples_files = glob.glob(str(SAMPLES_DIR / "**" / "*.json"), recursive=True)
|
23
|
-
|
24
|
-
|
25
|
-
def load_json_file(file_path):
|
26
|
-
"""Load a JSON file and return the parsed JSON object."""
|
27
|
-
with open(file_path, "r", encoding="utf-8") as f:
|
28
|
-
return json.load(f)
|
29
|
-
|
30
|
-
|
31
|
-
@pytest.mark.parametrize("sample_path", official_samples_files)
|
32
|
-
def test_official_sample(sample_path):
|
33
|
-
"""Test that official JSON-stat samples validate successfully."""
|
34
|
-
try:
|
35
|
-
# Load the JSON file
|
36
|
-
data = load_json_file(sample_path)
|
37
|
-
|
38
|
-
# Validate the JSON-stat object
|
39
|
-
result = validate_jsonstat(data)
|
40
|
-
assert result is True, f"Failed to validate {sample_path}"
|
41
|
-
except ValueError as e:
|
42
|
-
pytest.fail(f"Failed to validate {sample_path}: {e}")
|
43
|
-
|
44
|
-
|
45
|
-
if __name__ == "__main__":
|
46
|
-
# This allows running the tests directly with python
|
47
|
-
# Run pytest with the following options:
|
48
|
-
# -v: verbose output (show test names)
|
49
|
-
# -s: don't capture stdout (allow print statements to be shown)
|
50
|
-
# __file__: run tests only in this file
|
51
|
-
pytest.main(["-vs", __file__])
|
@@ -1,51 +0,0 @@
|
|
1
|
-
jsonstat_validator/__init__.py,sha256=wAFP3mKN6XwAPNRygWr_pSHDdKJ6F4Y7sp8sl1C1zuw,691
|
2
|
-
jsonstat_validator/validator.py,sha256=i5g57AkanmTMu-B4pUfeuVlXbj3OAdBwGpyFvo3S0Ek,22107
|
3
|
-
jsonstat_validator/tests/__init__.py,sha256=5w3FOHjkruZRg3oUSCmYHNKHTmESy3wFPynq05XLb_s,44
|
4
|
-
jsonstat_validator/tests/conftest.py,sha256=2UZL2pdcbM1iO2Uv837HPr6csDpIkhbnH_3v5aDDhW0,249
|
5
|
-
jsonstat_validator/tests/custom_tests.py,sha256=lJbhOipLEwPJdVHLVg-dTl4Q2cQK9Lkfs2us33qUfo8,14477
|
6
|
-
jsonstat_validator/tests/test_official_samples.py,sha256=yRXVqETmVUYNib-nf0odgShbo0Pq5YY4JJCj35KGzf0,1658
|
7
|
-
jsonstat_validator/tests/samples/canada.json,sha256=a6eMhLAA6HykWO2t11l5tpz0i6v2zN6izmvpcQbHGrY,3105
|
8
|
-
jsonstat_validator/tests/samples/galicia.json,sha256=W6ymWRax14yxAK_778A9kIWXdVV_6R5VLUJH4pv_AZI,22102
|
9
|
-
jsonstat_validator/tests/samples/hierarchy.json,sha256=NxvVVWmM5TBBeEdHUkmorh-PoN5D82-m3IIFXJO5UH8,8881
|
10
|
-
jsonstat_validator/tests/samples/index.json,sha256=0DjvjTpS8D0IDW8oyHsk3E5hRucnubekAMSflR_Lgyw,893
|
11
|
-
jsonstat_validator/tests/samples/oecd.json,sha256=3aRoESyTT4xJQDMljgvF6RXKWCmnirl0_7nNFTT2TPM,10917
|
12
|
-
jsonstat_validator/tests/samples/order.json,sha256=2mlvBudHeTiEUHqjPkoO4ZO7ztbwxZ7HiO_YJ1Br-8E,851
|
13
|
-
jsonstat_validator/tests/samples/us-gsp.json,sha256=L427DYaM9wq633nQ-ul32NNyPzQ3tBMIKQ_8FJTpojM,4808
|
14
|
-
jsonstat_validator/tests/samples/us-labor.json,sha256=lVhVpNQj9E90uLDukxe6cVI1IQRZKtewRAT1gPGK0rg,245081
|
15
|
-
jsonstat_validator/tests/samples/us-unr.json,sha256=uz0uwa4a1WwxzJgQCAe3Uh29nYuyN2agLF76UX4Vyzk,77734
|
16
|
-
jsonstat_validator/tests/samples/areas/canada.json,sha256=7wU11arz_dvX-_svc4B3haC-b1cc7sum69fovxu0aZw,363
|
17
|
-
jsonstat_validator/tests/samples/areas/galicia.json,sha256=0Fi3gCcp9HKbQd-kqhbZXg8OZ8eUByZRs3swmQJ3rQ0,405
|
18
|
-
jsonstat_validator/tests/samples/areas/index.json,sha256=OnXC6nJodtgIY23dNN4PEgL340t4YAnABcF_gZelGI0,745
|
19
|
-
jsonstat_validator/tests/samples/areas/oecd.json,sha256=eUGD5KjgNvbIJdyg4S7LJSUZehUKIcmfE7DM0fLZO1k,366
|
20
|
-
jsonstat_validator/tests/samples/areas/us.json,sha256=5voj9CXI91w0CM2zIzfJNEXBmhaxupRZcQrLUzptdWU,682
|
21
|
-
jsonstat_validator/tests/samples/datasets/index.json,sha256=upGVvsV0VvBV0UM0DyUvxUUwOG4DBBnvR2kb6KYqaS4,1525
|
22
|
-
jsonstat_validator/tests/samples/metrics/index.json,sha256=33CQfmS-f6pzvNqgBpRI4daCGu8L6GCJ-A4jcQSuYq0,684
|
23
|
-
jsonstat_validator/tests/samples/metrics/gdp/gsp.json,sha256=SbrOZurhvS-CxraYnVZqN293yQh2I9pAputsM4o25Yo,367
|
24
|
-
jsonstat_validator/tests/samples/metrics/gdp/gsppc.json,sha256=HHqqIS4JVOYD7206a9dUUucZbHcRqmgUt_xP0WXlRvk,380
|
25
|
-
jsonstat_validator/tests/samples/metrics/gdp/gspw.json,sha256=_P5hzfWmMUg9msznHcYBl-0_0Hg3A3AaRC79Qk7CqJ0,398
|
26
|
-
jsonstat_validator/tests/samples/metrics/gdp/index.json,sha256=JXd2_VRpAm8X_Z6twnqFTUplXxtfHQLEFAdys549guM,738
|
27
|
-
jsonstat_validator/tests/samples/metrics/lfs/employed.json,sha256=VmngzssIpzuyNAKboH7wf2197i7XxtwaotOcNMAQi-0,380
|
28
|
-
jsonstat_validator/tests/samples/metrics/lfs/index.json,sha256=sZ28CZOTEl0Py0Gfe6wiMmBkVxZdeGQq4OchpxprSmE,825
|
29
|
-
jsonstat_validator/tests/samples/metrics/lfs/lf.json,sha256=ScaE824vHG6Q7T23IMtCt9NnpJNmcsSt2LGN_b7XBvg,377
|
30
|
-
jsonstat_validator/tests/samples/metrics/lfs/unemployed.json,sha256=bVmWBE5-XcuRIzON1M0XMb_GPxBSkR3CbGQ79sMCqI4,384
|
31
|
-
jsonstat_validator/tests/samples/metrics/lfs/unr.json,sha256=lUKMphIFxbZlnduyHCt04q8DJKBZen2l2L2fK0qXE58,549
|
32
|
-
jsonstat_validator/tests/samples/metrics/pop/index.json,sha256=llnmomRkIZJWiBstp4yUbbmeMRPZjbte4xxfwRIQ_s8,525
|
33
|
-
jsonstat_validator/tests/samples/metrics/pop/pop.json,sha256=FIeNapSq3bD4BBLM48IXTEZXvwk03Fsfm4OozQLzpCM,718
|
34
|
-
jsonstat_validator/tests/samples/metrics/pop/popw.json,sha256=GB6PlpnkDrfZfJRyF9pyHtst42Oa19NKyqf2hYBXcJs,387
|
35
|
-
jsonstat_validator/tests/samples/sources/bls.json,sha256=Am3nXApblwvZ-WNcjOYN3jSvmYxlhFZfvTwcsCtFtTw,557
|
36
|
-
jsonstat_validator/tests/samples/sources/ige.json,sha256=x_ARvi4WomJu3848bZkjxEWNH5FrXZaRu_byiELQM_4,430
|
37
|
-
jsonstat_validator/tests/samples/sources/index.json,sha256=uk6UmFT9Pzi6tlMt6rEn3OxQWhYkPJnQ3PInzH_gh4c,1101
|
38
|
-
jsonstat_validator/tests/samples/sources/jsonstat.json,sha256=vC8j0Hyt445QKqu-tjhdXhrdSj3jqediKh9egaXIOiY,525
|
39
|
-
jsonstat_validator/tests/samples/sources/oecd.json,sha256=vryyWeBjwQsBbvCsYmojbRZ5y0zoL9fj2wPLBseUd20,365
|
40
|
-
jsonstat_validator/tests/samples/sources/statcan.json,sha256=ocZuRPZCRCxI-Wv0pi3wgXSDOeppoGPW-14rfVbOAlo,379
|
41
|
-
jsonstat_validator/tests/samples/sources/wikipedia.json,sha256=Xs3X4Pw_mXvxi8BfzdwKA4qhu_w47wTMU3NMxXLoBY8,359
|
42
|
-
jsonstat_validator/tests/samples/topics/accounts.json,sha256=ReLpG62nfWCHWeev-x-tuxb1anFnIW2utXM-bsEsNZ0,364
|
43
|
-
jsonstat_validator/tests/samples/topics/demos.json,sha256=SaKOqgnHvy8zOh7FMqtX7emXhapb0iy-pGGbbLQzHVA,522
|
44
|
-
jsonstat_validator/tests/samples/topics/index.json,sha256=1fbgaSXbeIypSASDOn6wJcMg77YenDXUY-QTHg4911k,766
|
45
|
-
jsonstat_validator/tests/samples/topics/labor.json,sha256=k270tRO9R_FE9VWJtlClDd9vmbaQuk_DK9VJXnxb1E0,695
|
46
|
-
jsonstat_validator/tests/samples/topics/population.json,sha256=OfRTyeMvTgM9HrugypUc0jWHrggSt43QpxCTAW--YUE,719
|
47
|
-
jsonstat_validator-0.1.0.dist-info/LICENSE,sha256=cyCvx3tHW8u9ZWGkTMrCKaB2ft4RonlMBVOEHDa2tEk,1091
|
48
|
-
jsonstat_validator-0.1.0.dist-info/METADATA,sha256=wzIjL1JHCdUtS5YyvQ4pkBsbC_Q8OXW2kCIHb3efvzM,6675
|
49
|
-
jsonstat_validator-0.1.0.dist-info/WHEEL,sha256=52BFRY2Up02UkjOa29eZOS2VxUrpPORXg1pkohGGUS8,91
|
50
|
-
jsonstat_validator-0.1.0.dist-info/top_level.txt,sha256=l6xoMFlWGRRbXMxl4MG-q0FA3In7rYZLBzVF8W7IhdU,19
|
51
|
-
jsonstat_validator-0.1.0.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|