File: test_garner_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 (33 lines) | stat: -rw-r--r-- 1,012 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
"""Test garner.dates."""

from proselint.checks.dates_times import dates

from .check import Check


class TestCheck(Check):
    """Test class for garner.dates."""

    __test__ = True

    def test_50s_hyphenation(self):
        """Find unneeded hyphen in 50's."""
        text = """The 50's were swell."""
        errors = dates.check_decade_apostrophes_short(text)
        assert len(errors) == 1

    def test_50_Cent_hyphenation(self):
        """Don't flag 50's when it refers to 50 Cent's manager."""
        text = """
            Dr. Dre suggested to 50's manager that he look into signing
            Eminem to the G-Unit record label.
        """
        errors = dates.check_decade_apostrophes_short(text)
        assert len(errors) == 0

    def test_dash_and_from(self):
        """Test garner.check_dash_and_from."""
        text = """From 1999-2002, Sally served as chair of the committee."""
        errors = dates.check_dash_and_from(text)
        print(errors)
        assert len(errors) == 1