Skip to content

Test type annotations #41

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Mar 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ jobs:
- name: Pre-commit Checks
run: pre-commit run --all-files

- name: Type Checking
run: poetry run mypy case_mapping example.py tests

- name: Unit Tests
run: poetry run pytest --doctest-modules

Expand Down
12 changes: 12 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ all: \
.venv-pre-commit/var/.pre-commit-built.log \
case.jsonld

.PHONY: \
check-mypy

# This virtual environment is meant to be built once and then persist, even through 'make clean'.
# If a recipe is written to remove this flag file, it should first run `pre-commit uninstall`.
.venv-pre-commit/var/.pre-commit-built.log:
Expand Down Expand Up @@ -101,6 +104,15 @@ case.ttl: \

check: \
all \
check-mypy \
case.ttl
source venv/bin/activate \
&& poetry run pytest --doctest-modules

check-mypy: \
.venv.done.log
source venv/bin/activate \
&& mypy \
case_mapping \
example.py \
tests
2 changes: 1 addition & 1 deletion case_mapping/uco/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def __init__(
The main CASE Object for representing a case and its activities and objects.
"""
super().__init__(*args, **kwargs)
self.build = []
self.build = [] # type: ignore
self["@context"] = {
"@vocab": "http://caseontology.org/core#",
"case-investigation": "https://ontology.caseontology.org/case/investigation/",
Expand Down
84 changes: 82 additions & 2 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ python = "^3.9"
pytz = "^2023.3.post1"

[tool.poetry.dev-dependencies]
mypy = "^1"
pytest = "^7.4.2"
types-pytz = "^2024"

[build-system]
requires = ["poetry-core"]
Expand Down