Skip to content

Commit c264401

Browse files
committed
Blacked.
1 parent 8ee4323 commit c264401

File tree

1 file changed

+27
-14
lines changed

1 file changed

+27
-14
lines changed

bin/jsonschema_suite

Lines changed: 27 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ def url_for_path(path):
8484

8585
return urljoin(
8686
REMOTES_BASE_URL,
87-
str(path.relative_to(REMOTES_DIR)).replace("\\", "/") # Windows...
87+
str(path.relative_to(REMOTES_DIR)).replace("\\", "/"), # Windows...
8888
)
8989

9090

@@ -100,7 +100,8 @@ class SanityTests(unittest.TestCase):
100100
print(f"Found {len(cls.test_files)} test files")
101101

102102
cls.output_test_files = [
103-
each for each in collect(OUTPUT_ROOT_DIR)
103+
each
104+
for each in collect(OUTPUT_ROOT_DIR)
104105
if each.name != "output-schema.json"
105106
]
106107
assert cls.output_test_files, "Didn't find the output test files!"
@@ -163,19 +164,21 @@ class SanityTests(unittest.TestCase):
163164
self.assertLess(
164165
len(case["description"]),
165166
150,
166-
"Description is too long (keep it to less than 150 chars)."
167+
"Description is too long (keep it to less than 150 chars).",
167168
)
168169

169170
def test_all_test_descriptions_have_reasonable_length(self):
170171
"""
171172
All tests have reasonably long descriptions.
172173
"""
173-
for count, test in enumerate(tests(self.test_files + self.output_test_files)):
174+
for count, test in enumerate(
175+
tests(self.test_files + self.output_test_files)
176+
):
174177
with self.subTest(description=test["description"]):
175178
self.assertLess(
176179
len(test["description"]),
177180
70,
178-
"Description is too long (keep it to less than 70 chars)."
181+
"Description is too long (keep it to less than 70 chars).",
179182
)
180183
print(f"Found {count} tests.")
181184

@@ -191,7 +194,9 @@ class SanityTests(unittest.TestCase):
191194
"""
192195
All test cases have unique test descriptions in their tests.
193196
"""
194-
for count, case in enumerate(cases(self.test_files + self.output_test_files)):
197+
for count, case in enumerate(
198+
cases(self.test_files + self.output_test_files)
199+
):
195200
with self.subTest(description=case["description"]):
196201
self.assertUnique(
197202
test["description"] for test in case["tests"]
@@ -226,7 +231,7 @@ class SanityTests(unittest.TestCase):
226231
Validator.check_schema(case["schema"])
227232
except jsonschema.SchemaError:
228233
self.fail(
229-
"Found an invalid schema."
234+
"Found an invalid schema. "
230235
"See the traceback for details on why."
231236
)
232237
else:
@@ -292,15 +297,21 @@ def main(arguments):
292297
try:
293298
import flask
294299
except ImportError:
295-
print(textwrap.dedent("""
300+
print(
301+
textwrap.dedent(
302+
"""
296303
The Flask library is required to serve the remote schemas.
297304
298305
You can install it by running `pip install Flask`.
299306
300307
Alternatively, see the `jsonschema_suite remotes` or
301308
`jsonschema_suite dump_remotes` commands to create static files
302309
that can be served with your own web server.
303-
""".strip("\n")))
310+
""".strip(
311+
"\n"
312+
)
313+
)
314+
)
304315
sys.exit(1)
305316

306317
app = flask.Flask(__name__)
@@ -324,25 +335,27 @@ check = subparsers.add_parser("check", help="Sanity check the test suite.")
324335

325336
flatten = subparsers.add_parser(
326337
"flatten",
327-
help="Output a flattened file containing a selected version's test cases."
338+
help="Output a flattened file containing a selected version's test cases.",
328339
)
329340
flatten.add_argument(
330341
"--randomize",
331342
action="store_true",
332343
help="Randomize the order of the outputted cases.",
333344
)
334345
flatten.add_argument(
335-
"version", help="The directory containing the version to output",
346+
"version",
347+
help="The directory containing the version to output",
336348
)
337349

338350
remotes = subparsers.add_parser(
339351
"remotes",
340352
help="Output the expected URLs and their associated schemas for remote "
341-
"ref tests as a JSON object."
353+
"ref tests as a JSON object.",
342354
)
343355

344356
dump_remotes = subparsers.add_parser(
345-
"dump_remotes", help="Dump the remote ref schemas into a file tree",
357+
"dump_remotes",
358+
help="Dump the remote ref schemas into a file tree",
346359
)
347360
dump_remotes.add_argument(
348361
"--update",
@@ -358,7 +371,7 @@ dump_remotes.add_argument(
358371

359372
serve = subparsers.add_parser(
360373
"serve",
361-
help="Start a webserver to serve schemas used by remote ref tests."
374+
help="Start a webserver to serve schemas used by remote ref tests.",
362375
)
363376

364377
if __name__ == "__main__":

0 commit comments

Comments
 (0)