3 sections
`pytest` Unit And Integration Tests
Tag slow or live-server tests with `@pytest.mark.integration` so you can run pure logic unit tests in milliseconds even when Ollama or the network is offline.
open drawer →---
~/cabinet/python
Everyday Python structure, syntax, pathlib, requests, and pytest patterns. Each drawer names its evidence and limits; course notes are not a substitute for a hands-on test.
3 sections
Tag slow or live-server tests with `@pytest.mark.integration` so you can run pure logic unit tests in milliseconds even when Ollama or the network is offline.
open drawer →3 sections
Wrap script entrypoints in `if __name__ == "__main__":` so importing a helper function doesn't accidentally run the whole script.
open drawer →3 sections
`pathlib.Path` treats file paths as objects instead of fragile strings—use `/` to join paths, `.glob()` to find files, and `.read_text()` / `.write_text()` for quick I/O.
open drawer →3 sections
Always pass a `timeout`, call `response.raise_for_status()`, and check keys after `response.json()`—otherwise a slow or failing API hangs your script or crashes with a confusing `KeyError`.
open drawer →2 sections
Reach for lists when order matters, dicts when you look things up by name, sets when you need unique items, and f-strings whenever you format text.
open drawer →