@@ -301,7 +301,7 @@ def test_add_creates_inline_meta(
301301 result = invoke (["add" , str (nb ), "polars==1" , "anywidget" ], uv_python = "3.11" )
302302 assert result .exit_code == 0
303303 assert filter_tempfile_ipynb (result .stdout ) == snapshot ("Updated `foo.ipynb`\n " )
304- assert filter_ids (nb .read_text ()) == snapshot ("""\
304+ assert filter_ids (nb .read_text (encoding = "utf-8" )) == snapshot ("""\
305305 {
306306 "cells": [
307307 {
@@ -344,7 +344,7 @@ def test_add_prepends_script_meta(
344344 result = invoke (["add" , str (path ), "polars==1" , "anywidget" ], uv_python = "3.10" )
345345 assert result .exit_code == 0
346346 assert filter_tempfile_ipynb (result .stdout ) == snapshot ("Updated `empty.ipynb`\n " )
347- assert filter_ids (path .read_text ()) == snapshot ("""\
347+ assert filter_ids (path .read_text (encoding = "utf-8" )) == snapshot ("""\
348348 {
349349 "cells": [
350350 {
@@ -404,7 +404,7 @@ def test_add_updates_existing_meta(
404404 result = invoke (["add" , str (path ), "polars==1" , "anywidget" ], uv_python = "3.13" )
405405 assert result .exit_code == 0
406406 assert filter_tempfile_ipynb (result .stdout ) == snapshot ("Updated `empty.ipynb`\n " )
407- assert filter_ids (path .read_text ()) == snapshot ("""\
407+ assert filter_ids (path .read_text (encoding = "utf-8" )) == snapshot ("""\
408408 {
409409 "cells": [
410410 {
@@ -444,7 +444,7 @@ def test_init_creates_notebook_with_inline_meta(
444444 assert filter_tempfile_ipynb (result .stdout ) == snapshot (
445445 "Initialized notebook at `empty.ipynb`\n "
446446 )
447- assert filter_ids (path .read_text ()) == snapshot ("""\
447+ assert filter_ids (path .read_text (encoding = "utf-8" )) == snapshot ("""\
448448 {
449449 "cells": [
450450 {
@@ -497,7 +497,7 @@ def test_init_creates_notebook_with_specific_python_version(
497497 assert filter_tempfile_ipynb (result .stdout ) == snapshot (
498498 "Initialized notebook at `empty.ipynb`\n "
499499 )
500- assert filter_ids (path .read_text ()) == snapshot ("""\
500+ assert filter_ids (path .read_text (encoding = "utf-8" )) == snapshot ("""\
501501 {
502502 "cells": [
503503 {
@@ -558,7 +558,7 @@ def test_init_with_deps(
558558 assert result .stdout == snapshot ("Initialized notebook at `Untitled.ipynb`\n " )
559559
560560 path = tmp_path / "Untitled.ipynb"
561- assert filter_ids (path .read_text ()) == snapshot ("""\
561+ assert filter_ids (path .read_text (encoding = "utf-8" )) == snapshot ("""\
562562 {
563563 "cells": [
564564 {
@@ -853,18 +853,18 @@ def test_stamp_script(
853853 tmp_path = pathlib .Path (tmpdir )
854854 monkeypatch .chdir (tmp_path )
855855
856- with (tmp_path / "foo.py" ).open ("w" ) as f :
856+ with (tmp_path / "foo.py" ).open ("w" , encoding = "utf-8" ) as f :
857857 f .write ("""# /// script
858858# requires-python = ">=3.13"
859859# dependencies = []
860860# ///
861861
862862
863- def main() -> None: |
864- print("Hello from foo.py!") |
865- |
866- |
867- if __name__ == "__main__": |
863+ def main() -> None:
864+ print("Hello from foo.py!")
865+
866+
867+ if __name__ == "__main__":
868868 main()
869869""" )
870870 result = invoke (["stamp" , "foo.py" , "--date" , "2006-01-02" ])
@@ -873,7 +873,7 @@ def main() -> None:
873873 assert result .stdout == snapshot (
874874 "Stamped `foo.py` with 2006-01-03T00:00:00-05:00\n "
875875 )
876- assert (tmp_path / "foo.py" ).read_text () == snapshot ("""\
876+ assert (tmp_path / "foo.py" ).read_text (encoding = "utf-8" ) == snapshot ("""\
877877 # /// script
878878# requires-python = ">=3.13"
879879# dependencies = []
@@ -883,11 +883,11 @@ def main() -> None:
883883# ///
884884
885885
886- def main() -> None: |
887- print("Hello from foo.py!") |
888- |
889- |
890- if __name__ == "__main__": |
886+ def main() -> None:
887+ print("Hello from foo.py!")
888+
889+
890+ if __name__ == "__main__":
891891 main()
892892""" )
893893
@@ -902,7 +902,7 @@ def test_stamp_clear(
902902 tmp_path = pathlib .Path (tmpdir )
903903 monkeypatch .chdir (tmp_path )
904904
905- with (tmp_path / "foo.py" ).open ("w" ) as f :
905+ with (tmp_path / "foo.py" ).open ("w" , encoding = "utf-8" ) as f :
906906 f .write ("""# /// script
907907# requires-python = ">=3.13"
908908# dependencies = []
@@ -916,7 +916,7 @@ def test_stamp_clear(
916916
917917 assert result .exit_code == 0
918918 assert result .stdout == snapshot ("Removed blah from `foo.py`\n " )
919- assert (tmp_path / "foo.py" ).read_text () == snapshot ("""\
919+ assert (tmp_path / "foo.py" ).read_text (encoding = "utf-8" ) == snapshot ("""\
920920 # /// script
921921# requires-python = ">=3.13"
922922# dependencies = []
@@ -950,7 +950,7 @@ def test_add_script_pinned(
950950) -> None :
951951 monkeypatch .chdir (tmp_path )
952952
953- with (tmp_path / "foo.py" ).open ("w" ) as f :
953+ with (tmp_path / "foo.py" ).open ("w" , encoding = "utf-8" ) as f :
954954 f .write ("""# /// script
955955# requires-python = ">=3.13"
956956# dependencies = []
@@ -962,7 +962,7 @@ def test_add_script_pinned(
962962 result = invoke (["add" , "foo.py" , "anywidget" , "--pin" ])
963963 assert result .exit_code == 0
964964 assert result .stdout == snapshot ("Updated `foo.py`\n " )
965- assert (tmp_path / "foo.py" ).read_text () == snapshot ("""\
965+ assert (tmp_path / "foo.py" ).read_text (encoding = "utf-8" ) == snapshot ("""\
966966 # /// script
967967# requires-python = ">=3.13"
968968# dependencies = [
0 commit comments