-
Notifications
You must be signed in to change notification settings - Fork 179
/
Copy pathtest_garner_dates.py
33 lines (25 loc) · 1012 Bytes
/
test_garner_dates.py
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