1
0
Fork 0
mirror of synced 2025-01-06 21:22:15 -05:00
dotbot/tests/test_noop.py
Anish Athalye abecc97bad Modernize project
This patch adds static typing, and it switches to the Hatch package
manager and its Hatchling build backend.
2024-12-27 22:01:05 -08:00

25 lines
564 B
Python

import os
import pytest
def test_success(root: str) -> None:
path = os.path.join(root, "abc.txt")
with open(path, "w") as f:
f.write("hello")
with open(path) as f:
assert f.read() == "hello"
def test_failure() -> None:
with pytest.raises(AssertionError):
open("abc.txt", "w") # noqa: SIM115
with pytest.raises(AssertionError):
open(file="abc.txt", mode="w") # noqa: SIM115
with pytest.raises(AssertionError):
os.mkdir("a")
with pytest.raises(AssertionError):
os.mkdir(path="a")