## 事象 dump add-onの[[HTML]]期待値が違う。改行の有無。 https://github.com/tadashi-aikawa/jumeaux/actions/runs/4803516081/jobs/8548076922 [[poetry.lock]]を削除して`poetry install`しなおすと再現するので、ライブラリアップデートによる問題。 ```console Package operations: 0 installs, 25 updates, 0 removals • Updating zipp (3.10.0 -> 3.15.0) • Updating importlib-metadata (5.0.0 -> 6.6.0) • Updating urllib3 (1.26.12 -> 1.26.15) • Updating botocore (1.28.1 -> 1.29.123) • Updating certifi (2022.9.24 -> 2022.12.7) • Updating charset-normalizer (2.1.1 -> 3.1.0) • Updating iniconfig (1.1.1 -> 2.0.0) • Updating packaging (21.3 -> 23.1) • Updating watchdog (2.1.9 -> 3.0.0) • Updating exceptiongroup (1.0.0rc9 -> 1.1.1) • Updating coverage (6.5.0 -> 7.2.4) • Updating mkdocs (1.4.1 -> 1.4.2) • Updating mypy-extensions (0.4.3 -> 1.0.0) • Updating pathspec (0.10.1 -> 0.11.1) • Updating pytest (7.2.0 -> 7.3.1) • Updating pytz (2022.5 -> 2023.3) • Updating pygments (2.13.0 -> 2.15.1) • Updating platformdirs (2.5.2 -> 3.5.0) • Updating typing-extensions (4.4.0 -> 4.5.0) • Updating mkdocs-material-extensions (1.1 -> 1.1.1) • Updating requests (2.28.1 -> 2.29.0) • Updating soupsieve (2.3.2.post1 -> 2.4.1) • Updating beautifulsoup4 (4.11.1 -> 4.12.2) • Updating boto3 (1.25.1 -> 1.26.123) • Updating lxml (4.9.1 -> 4.9.2) ``` 怪しいのは `jumeaux/addons/dump/html.py`の以下あたり。 ```python def pretty(html: str) -> str: return BeautifulSoup(html, "lxml").html.prettify() ``` [[Beautiful Soup]]のバージョンアップによる影響と予想。 ## [[Beautiful Soup]]の問題切り分け [[Beautiful Soup]]は現在4.12.2なので、4.11.1に固定化する。 ```diff [tool.poetry.dependencies] ... - beautifulsoup4 = "^4.8.1" + beautifulsoup4 = "4.11.1" ``` ```console $ poetry update Updating dependencies Resolving dependencies... Writing lock file Package operations: 0 installs, 1 update, 0 removals • Updating beautifulsoup4 (4.12.2 -> 4.11.1) ``` これで `make test` を実行すると通る。つまりこの差分は[[Beautiful Soup]]の4.12による変更で確定。 ## 期待値と実際の値 実際の値は最後に改行が加わっている。 ``` > assert expected_body == actual.body E AssertionError: assert b'<html>\n <head>\n <title>\n ??\xbf\xe3?\xa4\xe3?????\n </title>\n </head>\n <body>\n <div>\n \xa5\xb3\xa5\xf3\xa5\xc6\xa5\xf3\xa5\xc4\n </div>\n </body>\n</html>' == b'<html>\n <head>\n <title>\n ??\xbf\xe3?\xa4\xe3?????\n </title>\n </head>\n <body>\n <div>\n \xa5\xb3\xa5\xf3\xa5\xc6\xa5\xf3\xa5\xc4\n </div>\n </body>\n</html>\n' ``` これ自体は自然な仕様なので問題ない。期待値を修正する方針で進める。