Skip to content

Commit

Permalink
fix version check script
Browse files Browse the repository at this point in the history
  • Loading branch information
JelleZijlstra committed Jan 30, 2022
1 parent ef1d9eb commit d2b67ea
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
2 changes: 1 addition & 1 deletion docs/usage_and_configuration/the_basics.md
Expand Up @@ -281,7 +281,7 @@ You can check the version of _Black_ you have installed using the `--version` fl

```console
$ black --version
black, version 22.1.0
black, 22.1.0
```

#### `--config`
Expand Down
17 changes: 9 additions & 8 deletions scripts/check_version_in_basics_example.py
Expand Up @@ -20,20 +20,21 @@ def main(changes: str, the_basics: str) -> None:

the_basics_html = commonmark.commonmark(the_basics)
the_basics_soup = BeautifulSoup(the_basics_html, "html.parser")
(version_example,) = [
version_examples = [
code_block.string
for code_block in the_basics_soup.find_all(class_="language-console")
if "$ black --version" in code_block.string
]

for tag in tags:
if tag in version_example and tag != latest_tag:
print(
"Please set the version in the ``black --version`` "
"example from ``the_basics.md`` to be the latest one.\n"
f"Expected {latest_tag}, got {tag}.\n"
)
sys.exit(1)
for version_example in version_examples:
if tag in version_example and tag != latest_tag:
print(
"Please set the version in the ``black --version`` "
"examples from ``the_basics.md`` to be the latest one.\n"
f"Expected {latest_tag}, got {tag}.\n"
)
sys.exit(1)


if __name__ == "__main__":
Expand Down

0 comments on commit d2b67ea

Please sign in to comment.