Skip to content

Commit

Permalink
Merge 0745774 into 8a1cdc1
Browse files Browse the repository at this point in the history
  • Loading branch information
Nytelife26 committed May 17, 2021
2 parents 8a1cdc1 + 0745774 commit b12879f
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 37 deletions.
10 changes: 4 additions & 6 deletions proselint/checks/uncomparables/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
attention and expects you to have done the same.
"""
import re
from proselint.tools import memoize
from proselint.tools import existence_check, memoize
import itertools


Expand Down Expand Up @@ -114,9 +114,7 @@ def check(text):
("more", "possible") # FIXME
]

all = [i[0] + r"\s" + i[1] + r"[\W$]" for i in itertools.product(
comparators, uncomparables) if i not in exceptions]
uncomparables = [fr"{i[0]}\s{i[1]}" for i in itertools.product(
comparators, uncomparables) if i not in exceptions]

occ = re.finditer("|".join(all), text.lower())
return [(o.start(), o.end(), err, msg.format(o.group(0)), None)
for o in occ]
return existence_check(text, uncomparables, err, msg, require_padding=True)
28 changes: 0 additions & 28 deletions tests/test_dfw_uncomparables.py

This file was deleted.

18 changes: 15 additions & 3 deletions tests/test_uncomparables.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
"""Tests for uncomparables.misc check."""
"""Test uncomparables.misc"""
from __future__ import absolute_import

from .check import Check

from proselint.checks.uncomparables import misc as chk


Expand All @@ -20,3 +18,17 @@ def test_smoke(self):
"""Basic smoke test for uncomparables.misc."""
assert self.passes("""Smoke phrase with nothing flagged.""")
assert not self.passes("""The item was more unique.""")

def test_sample_phrases(self):
"""Find 'very unique'."""
assert not self.passes("""This sentence is very unique.""")

def test_spaces(self):
"""Handle spacing correctly."""
assert not self.passes("""This sentence is very\nunique.""")
assert not self.passes("""Kind of complete.""")
assert self.passes("""Every perfect instance.""")

def test_constitutional(self):
"""Don't flag exceptions."""
assert self.passes("""A more perfect union.""")

0 comments on commit b12879f

Please sign in to comment.