File: test_dates_times_am_pm.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 (74 lines) | stat: -rw-r--r-- 2,134 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
"""Tests for dates_times.am_pm check."""

from proselint.checks.dates_times import am_pm as chk

from .check import Check


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

    __test__ = True

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

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

        This is for the function
        dates_times.am_pm.check_lowercase_periods.

        """
        assert chk.check_lowercase_periods(
            "Basic smoke phrase without issues.") == []
        assert chk.check_lowercase_periods(
            "It happened at 7 a.m.") == []
        assert chk.check_lowercase_periods(
            "It happened at 7 am.") != []
        assert chk.check_lowercase_periods(
            "On Wed, Sep 21, 2016 at 11:42 AM -0400, X wrote:") == []

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

        This is for the function
        dates_times.am_pm.check_spacing.

        """
        assert chk.check_spacing(
            "Basic smoke phrase without issues.") == []
        assert chk.check_spacing(
            "It happened at 7 a.m.") == []
        assert chk.check_spacing(
            "It happened at 7a.m.") != []

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

        This for the function
        dates_times.am_pm.midnight_noon.

        """
        assert chk.check_midnight_noon(
            "Basic smoke phrase without issues.") == []
        assert chk.check_midnight_noon(
            "It happened at noon.") == []
        assert chk.check_midnight_noon(
            "It happened at 12 a.m.") != []

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

        This for the function
        dates_times.am_pm.check_redundancy.

        """
        assert len(chk.check_redundancy(
            "Basic smoke phrase without issues.")) == 0
        assert len(chk.check_redundancy(
            "It happened at 7 a.m.")) == 0
        assert len(chk.check_redundancy(
            "It happened at 7a.m. in the morning.")) == 1