def test_update_content(caplog): caplog.set_level(logging.DEBUG) old_content = """ =================== astroid's ChangeLog =================== What's New in astroid 2.6.1? ============================ Release date: TBA """ expected_beginning = """ =================== astroid's ChangeLog =================== What's New in astroid 2.6.2? ============================ Release date: TBA What's New in astroid 2.6.1? ============================ Release date: 20""" new_content = transform_content(old_content, "2.6.1") assert new_content[:len(expected_beginning)] == expected_beginning
def test_update_content_minor(): old_content = """ =================== astroid's ChangeLog =================== What's New in astroid 2.7.0? ============================ Release date: TBA """ expected_beginning = """ =================== astroid's ChangeLog =================== What's New in astroid 2.8.0? ============================ Release date: TBA What's New in astroid 2.7.1? ============================ Release date: TBA What's New in astroid 2.7.0? ============================ Release date: 20""" new_content = transform_content(old_content, "2.7.0") assert new_content[:len(expected_beginning)] == expected_beginning
def test_update_content_major(caplog): caplog.set_level(logging.DEBUG) old_content = """ =================== astroid's ChangeLog =================== What's New in astroid 3.0.0? ============================ Release date: TBA What's New in astroid 2.7.1? ============================ Release date: 2020-04-03 What's New in astroid 2.7.0? ============================ Release date: 2020-04-01 """ expected_beginning = """ =================== astroid's ChangeLog =================== What's New in astroid 3.1.0? ============================ Release date: TBA What's New in astroid 3.0.1? ============================ Release date: TBA What's New in astroid 3.0.0? ============================ Release date: 20""" new_content = transform_content(old_content, "3.0.0") assert new_content[:len(expected_beginning)] == expected_beginning
def test_update_content_error(old_content, version, expected_error, caplog): caplog.set_level(logging.DEBUG) with pytest.raises(AssertionError, match=expected_error): transform_content(old_content, version)