Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
fordnox committed Dec 7, 2023
1 parent 4eaba04 commit 37e032d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
3 changes: 3 additions & 0 deletions tests/wordplex_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ def test_pattern():
wp.set_format("VC")
assert wp.get_pattern() == [wp.vowels, wp.consonants]

wp.set_format("@#")
assert wp.get_pattern() == [wp.letters, wp.numbers]


def test_set_format():
wp.set_format("CVV")
Expand Down
7 changes: 4 additions & 3 deletions wordplex/wordplex.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ def __init__(self):
self._format = "VC"
self._suffix = ""
self._prefix = ""
self.alphabet_symbol = "@"

def reset(self):
self.set_suffix("")
Expand All @@ -57,8 +58,8 @@ def set_format_by_word(self, word: str):
for a in word:
if self.is_positive_integer(a):
new_format += "#"
if a.lower() == "@":
new_format += "@"
if a.lower() == self.alphabet_symbol:
new_format += self.alphabet_symbol
if a.lower() in self.vowels:
new_format += "V"
if a.lower() in self.consonants:
Expand Down Expand Up @@ -92,7 +93,7 @@ def get_pattern(self):
pattern.append(self.vowels)
elif letter == "#":
pattern.append(self.numbers)
elif letter == "@":
elif letter == self.alphabet_symbol:
pattern.append(self.letters)
else:
pattern.append([letter])
Expand Down

0 comments on commit 37e032d

Please sign in to comment.