def test_single_version_with_header_Changelog(): changelog = Changelog('foo') populate_changelog_from_rst(changelog, single_version_with_header_rst) expected_versions = ['0.0.1'] versions = [] for version, date, content in changelog.foreach_version(): versions.append(version) assert sorted(expected_versions) == sorted(versions)
def test_Changelog(): # Example is from REP-0132 changelog = Changelog('foo') populate_changelog_from_rst(changelog, example_rst) expected_versions = ['0.1.26', '0.1.25', '0.1.0', '0.0.1'] versions = [] content_checks = { '0.1.26': check_0_1_26, '0.1.25': check_0_1_25, '0.1.0': check_0_1_0, '0.0.1': check_0_0_1 } for version, date, content in changelog.foreach_version(): versions.append(version) if version in content_checks: content_checks[version](content) assert sorted(expected_versions) == sorted(versions)