From 619a87ef4263f2a789248865085938e56a0d97c0 Mon Sep 17 00:00:00 2001 From: Xander Harris Date: Fri, 3 Feb 2023 12:12:27 -0800 Subject: [PATCH] Update tests See #1 --- Pipfile | 3 +++ Pipfile.lock | 26 +++++++++++++++++++++++++- sphinxjsondomain.py | 3 ++- test_sphinxjsondomain.py | 5 +++++ 4 files changed, 35 insertions(+), 2 deletions(-) create mode 100644 test_sphinxjsondomain.py diff --git a/Pipfile b/Pipfile index db84f54..4fb77ff 100644 --- a/Pipfile +++ b/Pipfile @@ -5,9 +5,12 @@ name = "pypi" [packages] sphinx = "*" +faker = "*" [dev-packages] jupyter = "*" +pytest = "*" +pytest-cov = "*" pyyaml = "*" semver = {ref = "2.13.0", git = "https://github.com/python-semver/python-semver.git"} wheel = "*" diff --git a/Pipfile.lock b/Pipfile.lock index 880eea5..e636ce2 100644 --- a/Pipfile.lock +++ b/Pipfile.lock @@ -1,7 +1,7 @@ { "_meta": { "hash": { - "sha256": "17c24d3186bb072e235e0be839258ef746a71eaeacd84ecbb3b808fc06c846d5" + "sha256": "ec57ca2d19bf2b5354cbe7c77ecf556462f55aeacaa93f695aabe0c94d9f9fbe" }, "pipfile-spec": 6, "requires": {}, @@ -139,6 +139,14 @@ "markers": "python_version >= '3.7'", "version": "==0.19" }, + "faker": { + "hashes": [ + "sha256:2375d0bbaf405dc4f1cbc771485a78ad952c776798e5c228eef3e7b337f78868", + "sha256:b76e5d2405470e3d38d37d1bfaa9d9bbf171bdf41c814f5bbd8117b121f6bccb" + ], + "index": "pypi", + "version": "==16.6.1" + }, "idna": { "hashes": [ "sha256:814f528e8dead7d329833b91c5faa87d60bf71824cd12a7530b5526063d02cb4", @@ -235,6 +243,14 @@ "markers": "python_version >= '3.6'", "version": "==2.14.0" }, + "python-dateutil": { + "hashes": [ + "sha256:0123cacc1627ae19ddf3c27a5de5bd67ee4586fbdd6440d9748f8abb483d3e86", + "sha256:961d03dc3453ebbc59dbdea9e4e11c5651520a876d0f4db161e8674aae935da9" + ], + "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'", + "version": "==2.8.2" + }, "pytz": { "hashes": [ "sha256:01a0681c4b9684a28304615eba55d1ab31ae00bf68ec157ec3708a8182dbbcd0", @@ -250,6 +266,14 @@ "markers": "python_version >= '3.7' and python_version < '4'", "version": "==2.28.2" }, + "six": { + "hashes": [ + "sha256:1e61c37477a1626458e36f7b1d82aa5c9b094fa4802892072e49de9c60c4c926", + "sha256:8abb2f1d86890a2dfb989f9a77cfcfd3e47c2a354b01111771326f8aa26e0254" + ], + "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'", + "version": "==1.16.0" + }, "snowballstemmer": { "hashes": [ "sha256:09b16deb8547d3412ad7b590689584cd0fe25ec8db3be37788be3810cbf19cb1", diff --git a/sphinxjsondomain.py b/sphinxjsondomain.py index 8285224..046bdcf 100644 --- a/sphinxjsondomain.py +++ b/sphinxjsondomain.py @@ -354,7 +354,7 @@ def generate_examples(self, docname): """ Generate example snippets after the document has been processed. - :param str docname: documentat that is being processed. This is + :param str docname: document that is being processed. This is used to report warnings. This is called from within :meth:`.process_doc` after our superclass @@ -508,6 +508,7 @@ def generate_sample_data(self, all_objects, fake_factory): def normalize_object_name(obj_name): + """Adjust object names to conform with our preferences.""" return re.sub(r'\s+', '-', obj_name).strip('-').lower() diff --git a/test_sphinxjsondomain.py b/test_sphinxjsondomain.py new file mode 100644 index 0000000..799b107 --- /dev/null +++ b/test_sphinxjsondomain.py @@ -0,0 +1,5 @@ +import sphinxjsondomain + +def test_normalize_object_name(): + """Test object name normalization.""" + assert True