File: test_checks.py

package info (click to toggle)
autosuspend 9.0.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,196 kB
  • sloc: python: 5,431; xml: 13; makefile: 10; javascript: 1
file content (25 lines) | stat: -rw-r--r-- 660 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import configparser

from autosuspend.checks import Check


class DummyCheck(Check):
    @classmethod
    def create(cls, name: str, config: configparser.SectionProxy) -> "DummyCheck":
        raise NotImplementedError()

    def check(self) -> str | None:
        pass


class TestCheck:
    class TestName:
        def test_returns_the_provided_name(self) -> None:
            name = "test"
            assert DummyCheck(name).name == name

        def test_has_a_sensible_default(self) -> None:
            assert DummyCheck().name is not None

    def test_has_a_string_representation(self) -> None:
        assert isinstance(str(DummyCheck("test")), str)