Skip to content

Commit

Permalink
pona: o kepeken nimi Pattern. ni li kama e nasin ona lon poka
Browse files Browse the repository at this point in the history
nasin pi tenpo pini li kama jo e sitelen taso li kama ala jo e nasin la
lipu re.MULTILINE li weka
  • Loading branch information
gregdan3 committed Aug 17, 2024
1 parent 2b4471b commit 56010d4
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 42 deletions.
4 changes: 2 additions & 2 deletions tests/test_cleaners.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from .test_utils import PROPER_NAME_RE


@given(st.from_regex(ConsecutiveDuplicatesRe.pattern.pattern))
@given(st.from_regex(ConsecutiveDuplicatesRe.pattern))
@example("tooooki a")
@example("muuuuuu")
@example("nnn")
Expand All @@ -25,7 +25,7 @@ def test_ConsecutiveDuplicatesRe(s: str):
assert a.lower() != b.lower(), (s, res)


@given(st.from_regex(ConsecutiveDuplicatesRe.pattern.pattern))
@given(st.from_regex(ConsecutiveDuplicatesRe.pattern))
@example("Aaa")
@example("aAa")
@example("aaA")
Expand Down
28 changes: 14 additions & 14 deletions tests/test_filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,36 +90,36 @@ def test_NimiLinkuSandbox(s: str):
assert res, repr(s)


@given(st.from_regex(Phonotactic.pattern.pattern, fullmatch=True))
@given(st.from_regex(Phonotactic.pattern, fullmatch=True))
@example("kijetesantakalu")
@example("n")
def test_Phonotactic(s: str):
res = Phonotactic.filter(s)
assert res, repr(s)


@given(st.from_regex(Phonotactic.pattern.pattern, fullmatch=True))
@given(st.from_regex(Phonotactic.pattern, fullmatch=True))
def test_LongPhonotactic(s: str):
len_ok = len(s) >= LongPhonotactic.length
res = LongPhonotactic.filter(s)
assert res == len_ok, repr(s) # will match given fullmatch


@given(st.from_regex(Syllabic.pattern.pattern, fullmatch=True))
@given(st.from_regex(Syllabic.pattern, fullmatch=True))
@example("wuwojitiwunwonjintinmanna")
def test_Syllabic(s: str):
res = Syllabic.filter(s)
assert res, repr(s)


@given(st.from_regex(Syllabic.pattern.pattern, fullmatch=True))
@given(st.from_regex(Syllabic.pattern, fullmatch=True))
def test_LongSyllabic(s: str):
len_ok = len(s) >= LongSyllabic.length
res = LongSyllabic.filter(s)
assert res == len_ok


@given(st.from_regex(AlphabeticRe.pattern.pattern, fullmatch=True))
@given(st.from_regex(AlphabeticRe.pattern, fullmatch=True))
@example("muems")
@example("mpptp")
@example("tptpt")
Expand All @@ -129,14 +129,14 @@ def test_Alphabetic(s: str):
assert res_fn == res_re, repr(s)


@given(st.from_regex(AlphabeticRe.pattern.pattern, fullmatch=True))
@given(st.from_regex(AlphabeticRe.pattern, fullmatch=True))
def test_LongAlphabetic(s: str):
len_ok = len(s) >= LongAlphabetic.length
res = LongAlphabetic.filter(s)
assert res == len_ok


@given(st.from_regex(AlphabeticRe.pattern.pattern, fullmatch=True))
@given(st.from_regex(AlphabeticRe.pattern, fullmatch=True))
def test_AlphabeticRe(s: str):
res_re = AlphabeticRe.filter(s)
assert res_re, repr(s)
Expand All @@ -148,7 +148,7 @@ def test_ProperName(s: str):
assert res, repr(s)


@given(st.from_regex(PunctuationRe.pattern.pattern, fullmatch=True))
@given(st.from_regex(PunctuationRe.pattern, fullmatch=True))
@example("[]")
@example(r"\\")
@example(r"\"")
Expand All @@ -161,14 +161,14 @@ def test_PunctuationRe1(s: str):
assert res, repr(s)


@given(st.from_regex(PunctuationRe.pattern.pattern, fullmatch=True))
@given(st.from_regex(PunctuationRe.pattern, fullmatch=True))
def test_PunctuationRe(s: str):
res_re = PunctuationRe.filter(s)
res_re1 = PunctuationRe1.filter(s)
assert res_re == res_re1, repr(s)


@given(st.from_regex(PunctuationRe.pattern.pattern, fullmatch=True))
@given(st.from_regex(PunctuationRe.pattern, fullmatch=True))
@example("\U000f1990") # UCSUR char
def test_Punctuation(s: str):
res_fn = Punctuation.filter(s)
Expand All @@ -185,7 +185,7 @@ def test_Numeric(s: str):


@given(
st.from_regex(PunctuationRe.pattern.pattern, fullmatch=True)
st.from_regex(PunctuationRe.pattern, fullmatch=True)
| st.from_regex(r"\d+", fullmatch=True),
)
def test_OrFilter(s: str):
Expand Down Expand Up @@ -259,8 +259,8 @@ def test_NotFilter(s: str):

@given(
st.sampled_from(list(FALSE_POS_SYLLABIC))
| st.from_regex(Syllabic.pattern.pattern, fullmatch=True)
| st.from_regex(AlphabeticRe.pattern.pattern, fullmatch=True)
| st.from_regex(Syllabic.pattern, fullmatch=True)
| st.from_regex(AlphabeticRe.pattern, fullmatch=True)
)
def test_AndNotFilter(s: str):
AndNotFilter = And(Syllabic, Not(FalsePosSyllabic))
Expand Down Expand Up @@ -309,7 +309,7 @@ def test_AddTokensToMemberFilterNegative(s: str):
| words_by_tag("usage_category", "sandbox")
),
)
| st.from_regex(Syllabic.pattern.pattern, fullmatch=True)
| st.from_regex(Syllabic.pattern, fullmatch=True)
)
def test_SubTokensFromMemberFilter(s: str):
NimiAlaFilter = NimiLinkuCore(sub=NimiPu.tokens)
Expand Down
46 changes: 23 additions & 23 deletions tests/test_preprocessors.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
)


@given(st.from_regex(URLs.pattern.pattern, fullmatch=True))
@given(st.from_regex(URLs.pattern, fullmatch=True))
@example("https://google.com")
@example("https://mun.la")
@example("https://discord.gg/")
Expand All @@ -32,7 +32,7 @@ def test_URLs(s: str):
assert URLs.process(s).strip() == ""


@given(st.from_regex(Spoilers.pattern.pattern, fullmatch=True))
@given(st.from_regex(Spoilers.pattern, fullmatch=True))
@example("|| | ||")
@example("|| content\n\n\ncontent ||")
@example("||\n||")
Expand All @@ -42,14 +42,14 @@ def test_Spoilers(s: str):
assert res == "", (repr(s), repr(res))


@given(st.from_regex(Backticks.pattern.pattern, fullmatch=True))
@given(st.from_regex(Backticks.pattern, fullmatch=True))
@example("` ` ` `")
def test_Backticks(s: str):
res = Backticks.process(s).strip()
assert res == "", (repr(s), repr(res))


@given(st.from_regex(Codeblock.pattern.pattern, fullmatch=True))
@given(st.from_regex(Codeblock.pattern, fullmatch=True))
@example(
"""```
```"""
Expand All @@ -68,15 +68,15 @@ def test_Codeblock(s: str):
assert res == "", (repr(s), repr(res))


@given(st.from_regex(ArrowQuote.pattern.pattern, fullmatch=True))
@given(st.from_regex(ArrowQuote.pattern, fullmatch=True))
@example("> base")
@example("> newline\n> newline")
def test_ArrowQuote(s: str):
res = ArrowQuote.process(s).strip()
assert res == "", (repr(s), repr(res))


@given(st.from_regex(DoubleQuotes.pattern.pattern, fullmatch=True))
@given(st.from_regex(DoubleQuotes.pattern, fullmatch=True))
@example('" "" "')
@example('" "\n" "')
@example('" \n "')
Expand All @@ -85,7 +85,7 @@ def test_DoubleQuotes(s: str):
assert res == "", (repr(s), repr(res))


@given(st.from_regex(SingleQuotes.pattern.pattern, fullmatch=True))
@given(st.from_regex(SingleQuotes.pattern, fullmatch=True))
@example("' '' '")
@example("' '\n' '")
@example("' \n '")
Expand All @@ -94,15 +94,15 @@ def test_SingleQuotes(s: str):
assert res == "", (repr(s), repr(res))


@given(st.from_regex(DiscordEmotes.pattern.pattern, fullmatch=True))
@given(st.from_regex(DiscordEmotes.pattern, fullmatch=True))
@example("<a:example:123123>")
@example("<:example:123123>")
def test_DiscordEmotes(s: str):
res = DiscordEmotes.process(s).strip()
assert res == "", (repr(s), repr(res))


@given(st.from_regex(DiscordMentions.pattern.pattern, fullmatch=True))
@given(st.from_regex(DiscordMentions.pattern, fullmatch=True))
@example("<@497549183847497739>")
@example("<@!457890000>")
@example("<@&18398198981985>")
Expand All @@ -111,15 +111,15 @@ def test_DiscordMentions(s: str):
assert res == "", (repr(s), repr(res))


@given(st.from_regex(DiscordChannels.pattern.pattern, fullmatch=True))
@given(st.from_regex(DiscordChannels.pattern, fullmatch=True))
@example("<#19858915>")
@example("<#18591912589812985>")
def test_DiscordChannels(s: str):
res = DiscordChannels.process(s).strip()
assert res == "", (repr(s), repr(res))


@given(st.from_regex(DiscordSpecial.pattern.pattern, fullmatch=True))
@given(st.from_regex(DiscordSpecial.pattern, fullmatch=True))
@example("<id:guide>")
@example("<id:browse>")
def test_DiscordSpecial(s: str):
Expand All @@ -128,11 +128,11 @@ def test_DiscordSpecial(s: str):


@given(
st.from_regex(DiscordEmotes.pattern.pattern, fullmatch=True)
| st.from_regex(DiscordMentions.pattern.pattern, fullmatch=True)
| st.from_regex(DiscordChannels.pattern.pattern, fullmatch=True)
| st.from_regex(DiscordSpecial.pattern.pattern, fullmatch=True)
| st.from_regex(AngleBracketObject.pattern.pattern, fullmatch=True)
st.from_regex(DiscordEmotes.pattern, fullmatch=True)
| st.from_regex(DiscordMentions.pattern, fullmatch=True)
| st.from_regex(DiscordChannels.pattern, fullmatch=True)
| st.from_regex(DiscordSpecial.pattern, fullmatch=True)
| st.from_regex(AngleBracketObject.pattern, fullmatch=True)
)
@example("<https://example.com>")
@example("<#123124125125>")
Expand All @@ -142,11 +142,11 @@ def test_AngleBracketObject(s: str):


@given(
st.from_regex(SingleQuotes.pattern.pattern, fullmatch=True)
| st.from_regex(DoubleQuotes.pattern.pattern, fullmatch=True)
| st.from_regex(Backticks.pattern.pattern, fullmatch=True)
| st.from_regex(ArrowQuote.pattern.pattern, fullmatch=True)
| st.from_regex(AllQuotes.pattern.pattern, fullmatch=True)
st.from_regex(SingleQuotes.pattern, fullmatch=True)
| st.from_regex(DoubleQuotes.pattern, fullmatch=True)
| st.from_regex(Backticks.pattern, fullmatch=True)
| st.from_regex(ArrowQuote.pattern, fullmatch=True)
| st.from_regex(AllQuotes.pattern, fullmatch=True)
)
@example("> bruh")
@example("`bruh`")
Expand All @@ -155,7 +155,7 @@ def test_AllQuotes(s: str):
assert res == "", (repr(s), repr(res))


@given(st.from_regex(Reference.pattern.pattern, fullmatch=True))
@given(st.from_regex(Reference.pattern, fullmatch=True))
@example("[[Brainstorm]]")
@example("[[Phatic Phrases]]")
@example("[[Yahoo!]]")
Expand All @@ -164,7 +164,7 @@ def test_Reference(s: str):
assert res == "", (repr(s), repr(res))


@given(st.from_regex(ColonEmotes.pattern.pattern, fullmatch=True))
@given(st.from_regex(ColonEmotes.pattern, fullmatch=True))
@example(":owe::owe:")
@example(":suffering:")
@example(":presid65despair:")
Expand Down
6 changes: 3 additions & 3 deletions tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@

token_strategy = (
st.sampled_from(list(words_by_usage(60)))
| st.from_regex(Phonotactic.pattern.pattern, fullmatch=True)
| st.from_regex(Syllabic.pattern.pattern, fullmatch=True)
| st.from_regex(Phonotactic.pattern, fullmatch=True)
| st.from_regex(Syllabic.pattern, fullmatch=True)
| st.from_regex(PROPER_NAME_RE, fullmatch=True)
| st.from_regex(AlphabeticRe.pattern.pattern, fullmatch=True)
| st.from_regex(AlphabeticRe.pattern, fullmatch=True)
)


Expand Down

0 comments on commit 56010d4

Please sign in to comment.