Skip to content

Commit 2dc5048

Browse files
vladistandalito
authored andcommitted
Whitespace fixing
1 parent 367172a commit 2dc5048

File tree

95 files changed

+1424
-1459
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

95 files changed

+1424
-1459
lines changed

CONTRIBUTING.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,13 @@ ALSO NOTE: github.com lets you create a pull request from the main branch, autom
3535

3636
### Upstream Testing
3737

38-
`linkml-runtime` is tightly coupled to upstream `linkml`,
38+
`linkml-runtime` is tightly coupled to upstream `linkml`,
3939
so all pull requests have their changes tested by running the upstream tests
4040
against the PR version of `linkml-runtime`.
4141

4242
In some circumstances, paired changes need to be made against *both*
4343
`linkml` and `linkml-runtime`, where testing against the `main` branch
44-
of `linkml` is insufficient.
44+
of `linkml` is insufficient.
4545

4646
When opening a pull request, you can specify that your PR needs to be
4747
tested against a specific upstream branch and repository by specifying it
@@ -50,15 +50,15 @@ in the first two lines of your pull request like this:
5050
```
5151
upstream_repo: my-cool-username/linkml
5252
upstream_branch: some-complicated-feature
53-
53+
5454
Hey everyone what up it's me your boy MC spongebob here with another banger
5555
... (PR continues)
5656
```
5757

5858
The order of the `upstream_repo` and `upstream_branch` tags doesn't matter,
5959
but they must be on the first two lines of the pull request comment and separated with a colon.
6060

61-
Maintainers can also specify upstream branches to test against when
61+
Maintainers can also specify upstream branches to test against when
6262
dispatching the `test-upstream` workflow manually via the GUI prompt.
6363

6464
Testing against an unverified upstream branch is not necessarily dangerous,
@@ -92,7 +92,7 @@ Once the code has been merged into the `main` branch on this repo, there are a f
9292

9393
* Use the [releases](https://github.com/linkml/linkml-runtime/releases) section of the Github interface to draft a new release.
9494
* Conventionally tags are prefixed with `v` so choose an appropriately versioned tag number. Ex., `v1.1.9` and such.
95-
* Leave the default `main` branch as the target. Use the same tag number for the release title as well. After that, use Github's autogenerated CHANGELOG button to generate release notes. If it's possible to simplify the notes and make it more succinct, you should.
95+
* Leave the default `main` branch as the target. Use the same tag number for the release title as well. After that, use Github's autogenerated CHANGELOG button to generate release notes. If it's possible to simplify the notes and make it more succinct, you should.
9696
* Once a release is created, a [Github Action](.github/workflows/pypi-publish.yaml) will take care of publishing the package to PyPI for you.
9797

9898
* Navigate to the [Actions](https://github.com/linkml/linkml-runtime/actions) tab, and verify that there is a ✅ next to the release tag that was just created. For ex., [v1.1.15](https://github.com/linkml/linkml-runtime/actions/runs/1656285916).

tests/Testing.md

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
A description of the existing LinkML testing system as envisioned by
33
Harold Solbrig and Dazhi Ziao
44

5-
__Note:__ The description below was written in the context of
5+
__Note:__ The description below was written in the context of
66
[linkml-runtime](https://github.com/linkml/linkml-runtime). Many (most?) of
77
the actual testing is performed in [linkml](https://github.com/linkml/linkml)
8-
proper. This document needs to become a single text that covers _both_ of
9-
these test envirnoments. See: [duplicate testing code issue](https://github.com/linkml/linkml-runtime/issues/125)
8+
proper. This document needs to become a single text that covers _both_ of
9+
these test environments. See: [duplicate testing code issue](https://github.com/linkml/linkml-runtime/issues/125)
1010
for followup.
1111

1212
## Philosophy
@@ -22,9 +22,9 @@ a) Be removed as an artifact of a development branch that is no
2222
used or
2323
b) Have a test added for it
2424

25-
## Basics
25+
## Basics
2626
All unit tests must be in the `tests` directory
27-
Tests are grouped by general function or purpose through the use
27+
Tests are grouped by general function or purpose through the use
2828
of python packages. At the time of this writing, the following
2929
testing packages were in use:
3030

@@ -51,7 +51,7 @@ testing packages were in use:
5151

5252
### Background
5353
Unit tests that validate output tend to follow the following evolutionary path:
54-
1) Developer 1 runs some bit of code that generates output that appears in
54+
1) Developer 1 runs some bit of code that generates output that appears in
5555
`print` statement:
5656
```python
5757
import unittest
@@ -72,7 +72,7 @@ Unit tests that validate output tend to follow the following evolutionary path:
7272
problem and change the unit test to read:
7373
```python
7474
import unittest
75-
75+
7676
expected = '''
7777
Date: Mon, Feb 7, 2021
7878
model Foo: expected
@@ -85,7 +85,7 @@ Unit tests that validate output tend to follow the following evolutionary path:
8585
if __name__ == '__main__':
8686
unittest.main()
8787
```
88-
After doing a bunch of messing w/ tabs and line feeds, developer
88+
After doing a bunch of messing w/ tabs and line feeds, developer
8989
1 finally gets this to work (on a Mac), and submits the revision.
9090
Soon after submission, the test fails because the test was run
9191
on Tue, Feb 8, so the text no longer matches. Developer 1 updates
@@ -98,7 +98,7 @@ Unit tests that validate output tend to follow the following evolutionary path:
9898
When they run the unit tests, `test_my_new_function` fails, along with
9999
several other function test cases that now utilize `my_new_function`.
100100
Developer 3 has to go through _each_ of these failures to a) confirm
101-
that they failed because of the change and b) editing the test cases
101+
that they failed because of the change and b) editing the test cases
102102
to reflect the new output.
103103

104104
At some point, developer 3 realizes that all these individual edits
@@ -171,7 +171,7 @@ has a different output directory than `test_loaders_dumpers`__
171171
issues report warnings along the way
172172
* `self.root_input_path` - testing root input path. Used for inputs such as "meta.yaml" that are
173173
used across many testing nodes
174-
* `self.root_expected_path` = testing root expected
174+
* `self.root_expected_path` = testing root expected
175175
* `self.root_temp_file_path` = testing root temp
176176
* `self._log` - logger for logging errors. Same across all tests, defined in `tests/support/mismatchlog.py`
177177

@@ -186,15 +186,15 @@ has a different output directory than `test_loaders_dumpers`__
186186
* `temp_file_path(*path: str, is_dir: bool = False` - Same as actual path, except for scratch files
187187
Note: In the current implementation, actual and temp share the same directory. This may not always
188188
be the case.
189-
* `log(file_or_directory: str, message: Optional[str] = None) -> None` - record an "error", acting
189+
* `log(file_or_directory: str, message: Optional[str] = None) -> None` - record an "error", acting
190190
according to the setting of `self.mismatch_action`. `file_or_directory` names the file associated
191-
with the error and `message` an optional identification of what was wrong.
191+
with the error and `message` an optional identification of what was wrong.
192192

193193
The current `log` behavior is to create an ordered list of error messages, which, depending upon
194194
the `mismatch_action`, get printed at the end of the run. Other, more complex behaviors are possible.
195195

196196
Note that `MismatchLog` does some cleaning up on the stack trace to focus in on the actual cause
197-
of the problem.
197+
of the problem.
198198

199199
## Using the testing environment
200200
### Test class setup
@@ -209,7 +209,7 @@ from linkml_runtime.utils import my_function
209209

210210
class MyFunctionTestCase(TestEnvironmentTestCase):
211211
env = env
212-
212+
213213
def test_single_file(self):
214214
""" Test that my function behaves correctly with a single output file """
215215
output_text = my_function(env.input_path('input.txt'))
@@ -225,7 +225,7 @@ will then compare the output with `tests\test_dir\output\input.mod` with the fol
225225
At the _end_ of `MyFunctionTestCase` execution, `self.log` will be printed as output and, if `FailOnce`,
226226
`self.assertFail` will be raised.
227227

228-
### eval_single_file
228+
### eval_single_file
229229
`eval_single_file(expected_file_path: str, actual_text: str, filtr: Callable[[str], str] = None, comparator: Callable[[str, str], str] = None) -> bool:`
230230

231231
* `expected_file_path` - path to expected output in `output` directory
@@ -247,7 +247,7 @@ At the _end_ of `MyFunctionTestCase` execution, `self.log` will be printed as ou
247247
* ClickTestCase.always_pass_comparator - always true. (Note: doesn't appear to be used at the moment)
248248

249249
Note that, if the expected output file does not exist, eval_single_file creates the missing file and
250-
then logs it as a mismatch. If the `mismatch_action` is `Ignore` or `Report`, any missing or
250+
then logs it as a mismatch. If the `mismatch_action` is `Ignore` or `Report`, any missing or
251251
mismatched files will be updated.
252252

253253
## Unit tests for LinkML generators
@@ -297,7 +297,7 @@ if __name__ == '__main__':
297297
unittest.main()
298298
```
299299
The above example calls the PythonGenerator with `issue_106.yaml` from the local `input` directory
300-
as an input. The python generator returns a string (`value_is_returned == True`), which is then
300+
as an input. The python generator returns a string (`value_is_returned == True`), which is then
301301
compared with `issue_106.py` in the local `output` directory. The `compare_python` comparator is used,
302302
which compares the generated text with `output/issue_106.py`. If the files do not match or `output/issue_106.py'
303303
doesn't exist:
@@ -348,7 +348,7 @@ class IssueOWLNamespaceTestCase(TestEnvironmentTestCase):
348348
def test_issue_no_default(self):
349349
""" Make sure that types are generated as part of the output """
350350
g = self._test_owl('issue_163b')
351-
351+
352352
A = URIRef('http://example.org/sample/example1/A')
353353
self.assertIn((A, RDF.type, OWL.Class), g)
354354
NAME = URIRef('http://example.org/sample/example1/name')
@@ -367,7 +367,7 @@ The above set of tests use the `OwlSchemaGenerator` to transform input YAML file
367367
format. The `_test_owl` method takes an input file name (e.g. `input/issue_163.yaml`) and generates
368368
the OWL turtle output (e.g. `input/issue_163.owl`). Note that in this case, we include `env.input_map`
369369
as an additional parameter (not sure why but...). It uses the RDF comparator on the output and,
370-
assuming that the `Report` mode is in operation, the output file is updated if necessary. _Note: We
370+
assuming that the `Report` mode is in operation, the output file is updated if necessary. _Note: We
371371
may want to consider what to do in `Fail` or `FailOnce` modes_. This test case then returns the
372372
generated OWL in the form of an RDF graph, which can be used to test for the presence or absence
373373
of individual fields.
@@ -382,15 +382,15 @@ of individual fields.
382382
means that the destination file name will be passed as a parameter to the generator function and
383383
the output will be found in that file
384384
* `filtr` -- Optional filter to remove non-comparable information, normalize format, etc.
385-
* `comparator` -- Optional comaprator that does non-standard (e.g. RDF) comparisons
385+
* `comparator` -- Optional comparator that does non-standard (e.g. RDF) comparisons
386386
* `use_testing_root` -- 'True' means that, instead of using the _local_ input, output and temp
387387
directories, those at the root of the testing package should be used. This parameter is used
388388
when one wants to run tests on the standard linkml yaml files.
389389

390390

391391
## generate_directory
392392
`generate_directory(self, dirname: Union[str, List[str]], generator: Callable[[str], None]) -> None`
393-
The `generate_directory` test is used to test generaters that produce multiple files (e.g. markdowngen)
393+
The `generate_directory` test is used to test generators that produce multiple files (e.g. markdowngen)
394394
### Parameters
395395
* `dirname` -- the relative path of the output directory. The directory will be first be created (and cleared)
396396
in the `temp` subdirectory. If a `list` is passed, each list element is a path element within the
@@ -445,8 +445,8 @@ The above example:
445445
comparator: Callable[[type(unittest.TestCase), str, str, str], str] = None, ) -> None
446446
```
447447
* `args` - the command line arguments to the function. This can either be one long string that will
448-
be parsed (e.g. "-r schema_definition -r slot_definition") or a list of strings (e.g.
449-
["-r", "schema_definition", "-r", sd]).
448+
be parsed (e.g. "-r schema_definition -r slot_definition") or a list of strings (e.g.
449+
["-r", "schema_definition", "-r", sd]).
450450
* `testFileOrDirectory` - where the output is to be put. _Note:_ this parameter is listed as optional,
451451
but the first line of code causes a failure if it isn't there. TBD: change this signature.
452452
* `expected_error` - if the unit test is expected to fail, this is the error that is expected
@@ -457,7 +457,7 @@ The above example:
457457
* `comparator` - file comparator
458458

459459
### ClickTestCase example
460-
The following code tests tha various parameters of the CSV generator:
460+
The following code tests the various parameters of the CSV generator:
461461
```python
462462
import unittest
463463
import click
@@ -488,4 +488,4 @@ class GenCSVTestCase(ClickTestCase):
488488
if __name__ == '__main__':
489489
unittest.main()
490490
```
491-
The above code tests all (or at least most) of the options for `gencsv`.
491+
The above code tests all (or at least most) of the options for `gencsv`.

tests/test_index/input/object-indexer-data.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,4 @@ persons:
2929
name: c1 (renamed)
3030
organizations:
3131
- id: ROR:1
32-
name: Acme
32+
name: Acme

tests/test_issues/input/include_core.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,3 @@ classes:
1919
root class
2020
slots:
2121
- id
22-

tests/test_issues/input/issue_8.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,3 @@ classes:
2020
root class
2121
slots:
2222
- id
23-

tests/test_issues/input/issue_8a.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,3 @@ classes:
2020
root class
2121
slots:
2222
- id
23-

tests/test_linkml_model/test_linkml_files.py

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,24 @@
1-
import pytest
2-
import requests
3-
from pathlib import Path
1+
from importlib.util import find_spec
42
from itertools import product
3+
from pathlib import Path
54
from urllib.parse import urlparse
6-
from importlib.util import find_spec
5+
6+
import pytest
7+
import requests
78

89
HAVE_REQUESTS_CACHE = bool(find_spec("requests_cache"))
910

1011
from linkml_runtime.linkml_model.linkml_files import (
11-
Source,
12-
Format,
13-
_Path,
14-
URL_FOR,
15-
LOCAL_PATH_FOR,
16-
LOCAL_BASE,
1712
GITHUB_IO_PATH_FOR,
1813
GITHUB_PATH_FOR,
14+
LOCAL_BASE,
15+
LOCAL_PATH_FOR,
1916
META_ONLY,
17+
URL_FOR,
18+
Format,
2019
ReleaseTag,
20+
Source,
21+
_Path,
2122
)
2223

2324
EXPECTED_FORMATS = [

tests/test_loaders_dumpers/README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@ This directory does a basic functional test of the different flavors of loaders
33
layout is as follows:
44
* input - contains sample(s) of input in the different possible formats.
55
* .json - plain old json representation of the input
6-
* .jsonld - RDF representation in JSONLD expanded format
7-
* .ttl - RDF representation in Turtle format
6+
* .jsonld - RDF representation in JSONLD expanded format
7+
* .ttl - RDF representation in Turtle format
88
* .yaml - YAML format. **Note:** YAML format is also used to test the dumpers -- see below
99
* jsonld_context - this contains a docker file to set up a JSON-LD context server.
10-
* models -
11-
* output - contains sample(s) of dumper output in various formats.
10+
* models -
11+
* output - contains sample(s) of dumper output in various formats.
1212

1313

1414
## Process
15-
The `loader` tests
15+
The `loader` tests

tests/test_loaders_dumpers/input/bacteria-taxon-class.ttl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,4 +106,4 @@ _:b14 a rdf:Statement ;
106106

107107
_:b15 a rdf:Statement ;
108108
rdf:predicate rdfs:comment ;
109-
rdf:object "Unprocessed triple, not connected to root node" .
109+
rdf:object "Unprocessed triple, not connected to root node" .

tests/test_loaders_dumpers/input/book_series_lotr.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"fantasy"
66
],
77
"creator": {
8-
"name": "JRR Tolkein",
8+
"name": "JRR Tolkien",
99
"from_country": "England"
1010
},
1111
"books": [

0 commit comments

Comments
 (0)