Skip to content

Commit

Permalink
more tests, all modules from C to L except links
Browse files Browse the repository at this point in the history
  • Loading branch information
joshmgrant authored and suchow committed Aug 17, 2016
1 parent 3b164d1 commit b15f8c5
Show file tree
Hide file tree
Showing 12 changed files with 317 additions and 3 deletions.
2 changes: 1 addition & 1 deletion proselint/checks/cursing/filth.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@


@memoize
def check_debased_language(text):
def check(text):
"""Check the text."""
err = "cursing.filth"
msg = u"""Nobody ever tells you this as a kid, but you're supposed to avoid
Expand Down
2 changes: 1 addition & 1 deletion proselint/checks/cursing/nfl.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@


@memoize
def check_debased_language(text):
def check(text):
"""Check the text."""
err = "cursing.nfl"
msg = u"The NFL won't print this word on a jersey."
Expand Down
2 changes: 1 addition & 1 deletion proselint/checks/cursing/nword.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@


@memoize
def check_repeated_exclamations(text):
def check(text):
"""Check the text."""
err = "cursing.nword"
msg = u"Take responsibility for the shitty words you want to say."
Expand Down
22 changes: 22 additions & 0 deletions tests/test_cursing_filth.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
"""Tests for cursing.filth check."""
from __future__ import absolute_import

from .check import Check

from proselint.checks.cursing import filth as chk


class TestCheck(Check):
"""The test class for cursing.filth."""

__test__ = True

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

def test_smoke(self):
"""Basic smoke test for cursing.filth."""
assert self.passes("""Smoke phrase with nothing flagged.""")
assert not self.passes("""Bad shit in this phrase.""")
22 changes: 22 additions & 0 deletions tests/test_cursing_nfl.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
"""Tests for cursing.nfl check."""
from __future__ import absolute_import

from .check import Check

from proselint.checks.cursing import nfl as chk


class TestCheck(Check):
"""The test class for cursing.nfl."""

__test__ = True

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

def test_smoke(self):
"""Basic smoke test for cursing.nfl."""
assert self.passes("""Smoke phrase with nothing flagged.""")
assert not self.passes("""The QB is named ball licker.""")
22 changes: 22 additions & 0 deletions tests/test_cursing_nword.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
"""Tests for cursing.nword check."""
from __future__ import absolute_import

from .check import Check

from proselint.checks.cursing import nword as chk


class TestCheck(Check):
"""The test class for cursing.nword."""

__test__ = True

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

def test_smoke(self):
"""Basic smoke test for cursing.nword."""
assert self.passes("""Smoke phrase with nothing flagged.""")
assert not self.passes("""The n-word.""")
73 changes: 73 additions & 0 deletions tests/test_dates_times_am_pm.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
"""Tests for dates_times.am_pm check."""
from __future__ import absolute_import

from .check import Check

from proselint.checks.dates_times import am_pm as chk


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

__test__ = True

@property
def this_check(self):
"""Bolierplate."""
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.") != []

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 chk.check_redundancy(
"Basic smoke phrase without issues.") == []
assert chk.check_redundancy(
"It happened at 7 a.m.") == []
assert chk.check_redundancy(
"It happened at 7a.m. in the morning.") != []
87 changes: 87 additions & 0 deletions tests/test_dates_times_dates.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
"""Tests for dates_times.dates check."""
from __future__ import absolute_import

from .check import Check

from proselint.checks.dates_times import dates as chk


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

__test__ = True

@property
def this_check(self):
"""Bolierplate."""
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 the 90s.") == []
assert chk.check_decade_apostrophes_short(
"It happened at 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.") != []
22 changes: 22 additions & 0 deletions tests/test_hedging.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
"""Tests for hedging.misc check."""
from __future__ import absolute_import

from .check import Check

from proselint.checks.hedging import misc as chk


class TestCheck(Check):
"""The test class for hedging.misc."""

__test__ = True

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

def test_smoke(self):
"""Basic smoke test for hedging.misc."""
assert self.passes("""Smoke phrase with nothing flagged.""")
assert not self.passes("""I would argue that this is a good test.""")
22 changes: 22 additions & 0 deletions tests/test_hyperbole.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
"""Tests for hyperbole.misc check."""
from __future__ import absolute_import

from .check import Check

from proselint.checks.hyperbole import misc as chk


class TestCheck(Check):
"""The test class for hyperbole.misc."""

__test__ = True

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

def test_smoke(self):
"""Basic smoke test for hyperbole.misc."""
assert self.passes("""Smoke phrase with nothing flagged.""")
assert not self.passes("""So exaggerated!!!""")
22 changes: 22 additions & 0 deletions tests/test_jargon.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
"""Tests for jargon.misc check."""
from __future__ import absolute_import

from .check import Check

from proselint.checks.jargon import misc as chk


class TestCheck(Check):
"""The test class for jargon.misc."""

__test__ = True

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

def test_smoke(self):
"""Basic smoke test for jargon.misc."""
assert self.passes("""Smoke phrase with nothing flagged.""")
assert not self.passes("""I agree it's in the affirmative.""")
22 changes: 22 additions & 0 deletions tests/test_lexical_illusions.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
"""Tests for lexical_illusions.misc check."""
from __future__ import absolute_import

from .check import Check

from proselint.checks.lexical_illusions import misc as chk


class TestCheck(Check):
"""The test class for lexical_illusions.misc."""

__test__ = True

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

def test_smoke(self):
"""Basic smoke test for lexical_illusions.misc."""
assert self.passes("""Smoke phrase with nothing flagged.""")
assert not self.passes("""Paris in the the springtime.""")

0 comments on commit b15f8c5

Please sign in to comment.