Skip to content

Commit

Permalink
Add readme tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ajparsons committed Aug 27, 2024
1 parent 33a3b1f commit 24e9fbd
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 6 deletions.
1 change: 1 addition & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ jobs:
shell: bash
run: |
python -m pytest -v tests
python -m pytest --markdown-docs README.md
- name: Test with ruff
shell: bash
Expand Down
16 changes: 11 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ After first use, there is some caching behind the scenes to speed this up.
from mysoc_validator import Popolo
from mysoc_validator.models.popolo import Chamber, IdentifierScheme
from datetime import date
popolo = Popolo.from_path(<path to people.json>)
popolo = Popolo.from_parlparse()

keir_starmer_parl_id = popolo.persons.from_identifier(4514, scheme=IdentifierScheme.MNIS)
keir_starmer_parl_id = popolo.persons.from_identifier("4514", scheme=IdentifierScheme.MNIS)
keir_starmer_name = popolo.persons.from_name(
"keir starmer", chamber_id=Chamber.COMMONS, date=date.fromisoformat("2022-07-31")
)
Expand All @@ -56,17 +56,23 @@ Python validator and handler for 'publicwhip' style transcript format.

```python
from mysoc_validator import Transcript
from pathlib import Path

transcript = Transcript.from_path(<path to xml file>)
transcript_file = Path("data", "debates2023-03-28d.xml")

transcript = Transcript.from_xml_path(transcript_file)
```

## Register of Interests

Python validator and handler for 'publicwhip' style interests format.

```python
from mysoc_validator import Registry
from mysoc_validator import Register
from pathlib import Path

register_file = Path("data", "regmem2024-05-28.xml")
interests = Register.from_xml_path(register_file)

interests = Registry.from_path(<path to xml file>)
```

52 changes: 51 additions & 1 deletion poetry.lock

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

1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ pyright = "^1.1"
toml = "^0.10.2"
ruff = "^0.5.5"
lxml-stubs = "^0.5.1"
pytest-markdown-docs = "^0.5.1"

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

0 comments on commit 24e9fbd

Please sign in to comment.