"""Юнит-тесты кратких библиографических ссылок по ГОСТ Р 7.0.5-2008.""" from app.formatters.gost_7_0_5 import GOST705Formatter, format_short def test_short_author_and_year(): assert format_short({"authors": [{"last_name": "Иванов"}], "year": 2023}) == "[Иванов, 2023]" def test_short_without_author_uses_title(): out = format_short({"title": "Большая книга про всё сразу", "year": 2020}) assert out == "[Большая книга про..., 2020]" def test_short_no_author_no_title(): assert format_short({"year": 2019}) == "[2019]" def test_short_missing_year_defaults(): assert format_short({"authors": [{"last_name": "Петров"}]}) == "[Петров, б. г.]" def test_inline_with_page(): f = GOST705Formatter() doc = {"authors": [{"last_name": "Иванов"}], "year": 2023} assert f.format_inline(doc, page="15") == "[Иванов, 2023, с. 15]" def test_inline_without_page(): f = GOST705Formatter() doc = {"authors": [{"last_name": "Иванов"}], "year": 2023} assert f.format_inline(doc) == "[Иванов, 2023]"