|
| 1 | +import datetime as dt |
| 2 | + |
| 3 | +from readme_rel.main import Release, Repository, render_repos |
| 4 | + |
| 5 | +SAMPLE_REPOS = [ |
| 6 | + Repository( # Page 1 |
| 7 | + name="xbmini-py", |
| 8 | + url="https://github.com/sco1/xbmini-py", |
| 9 | + n_releases=5, |
| 10 | + last_release=Release( |
| 11 | + tag_name="v0.5.0", |
| 12 | + published=dt.datetime.fromisoformat("2025-01-06T20:44:16Z"), |
| 13 | + url="https://github.com/sco1/xbmini-py/releases/tag/v0.5.0", |
| 14 | + ), |
| 15 | + ), |
| 16 | + Repository( # Page 2 |
| 17 | + name="matplotlib-window", |
| 18 | + url="https://github.com/sco1/matplotlib-window", |
| 19 | + n_releases=3, |
| 20 | + last_release=Release( |
| 21 | + tag_name="v1.1.0", |
| 22 | + published=dt.datetime.fromisoformat("2024-12-31T01:26:50Z"), |
| 23 | + url="https://github.com/sco1/matplotlib-window/releases/tag/v1.1.0", |
| 24 | + ), |
| 25 | + ), |
| 26 | + Repository( # Page 1 |
| 27 | + name="pyflysight", |
| 28 | + url="https://github.com/sco1/pyflysight", |
| 29 | + n_releases=9, |
| 30 | + last_release=Release( |
| 31 | + tag_name="v0.9.0", |
| 32 | + published=dt.datetime.fromisoformat("2024-11-27T17:52:24Z"), |
| 33 | + url="https://github.com/sco1/pyflysight/releases/tag/v0.9.0", |
| 34 | + ), |
| 35 | + ), |
| 36 | +] |
| 37 | + |
| 38 | +# fmt: off |
| 39 | +TRUTH_RENDERED = """\ |
| 40 | +* 2025-01-06: [`xbmini-py`](https://github.com/sco1/xbmini-py) `v0.5.0` ([Changelog](https://github.com/sco1/xbmini-py/releases/tag/v0.5.0), [Tree](https://github.com/sco1/xbmini-py/tree/v0.5.0)) |
| 41 | +* 2024-12-31: [`matplotlib-window`](https://github.com/sco1/matplotlib-window) `v1.1.0` ([Changelog](https://github.com/sco1/matplotlib-window/releases/tag/v1.1.0), [Tree](https://github.com/sco1/matplotlib-window/tree/v1.1.0)) |
| 42 | +* 2024-11-27: [`pyflysight`](https://github.com/sco1/pyflysight) `v0.9.0` ([Changelog](https://github.com/sco1/pyflysight/releases/tag/v0.9.0), [Tree](https://github.com/sco1/pyflysight/tree/v0.9.0)) """ |
| 43 | +# fmt: on |
| 44 | + |
| 45 | + |
| 46 | +def test_render_repos() -> None: |
| 47 | + assert render_repos(SAMPLE_REPOS) == TRUTH_RENDERED |
0 commit comments