File: test_dates_times_dates.py

package info (click to toggle)
python3-proselint 0.14.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,220 kB
  • sloc: python: 7,173; sh: 6; makefile: 3
file content (86 lines) | stat: -rw-r--r-- 2,623 bytes parent folder | download
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
"""Tests for dates_times.dates check."""

from proselint.checks.dates_times import dates as chk

from .check import Check


class TestCheck(Check):
    """The test class for dates_times.dates."""

    __test__ = True

    @property
    def this_check(self):
        """Boilerplate."""
        return chk

    def test_smoke_check_decade_apostrophes_short(self):
        """Basic smoke test.

        This for the function
        dates_times.dates.check_decade_apostrophes_short.

        """
        assert chk.check_decade_apostrophes_short(
            "Basic smoke phrase without issues.") == []
        assert chk.check_decade_apostrophes_short(
            "It happened in the 90s.") == []
        assert chk.check_decade_apostrophes_short(
            "It happened in the 90's.") != []

    def test_smoke_check_decade_apostrophes_long(self):
        """Basic smoke test.

        This is for the function
        dates_times.dates.decade_apostrophes_long.

        """
        assert chk.check_decade_apostrophes_long(
            "Basic smoke phrase without issues.") == []
        assert chk.check_decade_apostrophes_long(
            "It happened in the 1980s.") == []
        assert chk.check_decade_apostrophes_long(
            "It happened in the 1980's.") != []

    def test_smoke_check_dash_and_from(self):
        """Basic smoke test.

        This for the function
        dates_times.dates.dash_and_from.

        """
        assert chk.check_dash_and_from(
            "Basic smoke phrase without issues.") == []
        assert chk.check_dash_and_from(
            "It happened from 2000 to 2005.") == []
        assert chk.check_dash_and_from(
            "It happened from 2000-2005.") != []

    def test_smoke_check_month_year_comma(self):
        """Basic smoke test.

        This is for the function
        dates_times.dates.check_month_year_comma.

        """
        assert chk.check_month_year_comma(
            "Basic smoke phrase without issues.") == []
        assert chk.check_month_year_comma(
            "It happened in August 2008.") == []
        assert chk.check_month_year_comma(
            "It happened in August, 2008.") != []

    def test_smoke_check_month_of_year(self):
        """Basic smoke test.

        This is for the function
        dates_times.dates.check_month_of_year.

        """
        assert chk.check_month_of_year(
            "Basic smoke phrase without issues.") == []
        assert chk.check_month_of_year(
            "It happened in August 2008.") == []
        assert chk.check_month_of_year(
            "It happened in August of 2008.") != []