-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
1,027 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
name: tests | ||
|
||
on: | ||
push: | ||
branches: [ "main" ] | ||
pull_request: | ||
branches: [ "main" ] | ||
workflow_dispatch: | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Check out code | ||
uses: actions/checkout@v4 | ||
- name: Set up Python 3.12 | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: "3.12" | ||
- name: Install uv | ||
run: make install-uv | ||
- name: Lint and test | ||
run: make |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
tests: lint install | ||
uv run pytest tests | ||
|
||
install-uv: | ||
curl -LsSf https://astral.sh/uv/0.4.27/install.sh | sh | ||
|
||
install: | ||
uv sync --all-extras --dev | ||
|
||
lint: | ||
uvx ruff check src | ||
uvx ruff check tests | ||
|
||
.PHONY: install-uv install lint tests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
"Module to read ARC schema" | ||
|
||
from pathlib import Path | ||
|
||
from arcmapper.arc import arc_schema_url, read_arc_schema | ||
|
||
|
||
def test_arc_schema_url(): | ||
assert arc_schema_url("1.0.0") == "https://github.com/ISARICResearch/DataPlatform/raw/refs/heads/main/ARCH/ARCH1.0.0/ARCH.csv" | ||
|
||
|
||
def test_read_arc_schema(): | ||
arc = read_arc_schema(str(Path(__file__).parent / 'data' / 'ARCH.csv')) | ||
print(arc) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
"Utility functions for arcmapper" | ||
from pathlib import Path | ||
|
||
import pandas as pd | ||
|
||
from arcmapper.util import read_data, read_csv_with_encoding_detection, parse_redcap_response | ||
|
||
def test_read_data(): | ||
arc_path = str(Path(__file__).parent / 'data' / 'ARCH.csv') | ||
assert isinstance(read_data(arc_path), pd.DataFrame) | ||
|
||
def test_read_csv_with_encoding_detection(): | ||
"Reads CSV file with encoding detection" | ||
|
||
arc_path = str(Path(__file__).parent / 'data' / 'ARCH.csv') | ||
assert isinstance(read_csv_with_encoding_detection(arc_path), pd.DataFrame) | ||
|
||
def test_parse_redcap_response(): | ||
assert parse_redcap_response("1, male | 2, female") == [("1", "male"), ("2", "female")] |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.