Pillow

Форк
0
/
test_util.py 
41 строка · 771.0 Байт
1
from __future__ import annotations
2

3
from pathlib import Path, PurePath
4

5
import pytest
6

7
from PIL import _util
8

9

10
@pytest.mark.parametrize(
11
    "test_path", ["filename.ext", Path("filename.ext"), PurePath("filename.ext")]
12
)
13
def test_is_path(test_path: str | Path | PurePath) -> None:
14
    # Act
15
    it_is = _util.is_path(test_path)
16

17
    # Assert
18
    assert it_is
19

20

21
def test_is_not_path(tmp_path: Path) -> None:
22
    # Arrange
23
    with (tmp_path / "temp.ext").open("w") as fp:
24
        pass
25

26
    # Act
27
    it_is_not = _util.is_path(fp)
28

29
    # Assert
30
    assert not it_is_not
31

32

33
def test_deferred_error() -> None:
34
    # Arrange
35

36
    # Act
37
    thing = _util.DeferredError.new(ValueError("Some error text"))
38

39
    # Assert
40
    with pytest.raises(ValueError):
41
        thing.some_attr
42

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.