Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
D
diceware-debian
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
drebs
diceware-debian
Commits
fe0d9a43
Commit
fe0d9a43
authored
Jul 28, 2015
by
ulif
Browse files
Options
Downloads
Patches
Plain Diff
Start a WordList class to avoid func scatter.
parent
b50c7e0b
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
diceware/wordlist.py
+7
-0
7 additions, 0 deletions
diceware/wordlist.py
tests/test_wordlist.py
+11
-1
11 additions, 1 deletion
tests/test_wordlist.py
with
18 additions
and
1 deletion
diceware/wordlist.py
+
7
−
0
View file @
fe0d9a43
...
...
@@ -132,3 +132,10 @@ def get_wordlist_path(name):
raise
ValueError
(
"
Not a valid wordlist name: %s
"
%
name
)
basename
=
'
wordlist_%s.txt
'
%
name
return
os
.
path
.
join
(
WORDLISTS_DIR
,
basename
)
class
WordList
(
object
):
"""
A word list contains words for building passphrases.
"""
def
__init__
(
self
,
opened_file
=
None
,
path
=
None
):
pass
This diff is collapsed.
Click to expand it.
tests/test_wordlist.py
+
11
−
1
View file @
fe0d9a43
...
...
@@ -3,7 +3,7 @@ import pytest
from
diceware.wordlist
import
(
WORDLISTS_DIR
,
RE_WORDLIST_NAME
,
RE_NUMBERED_WORDLIST_ENTRY
,
get_wordlist
,
get_signed_wordlist
,
get_wordlist_path
,
get_wordlist_names
,
is_signed_wordlist
,
refine_wordlist_entry
,
is_signed_wordlist
,
refine_wordlist_entry
,
WordList
,
)
...
...
@@ -189,3 +189,13 @@ class TestWordlistModule(object):
def
test_refine_wordlist_strips_also_numbered
(
self
):
# also numbered entries are stripped
assert
refine_wordlist_entry
(
"
11111
\t
foo
\n
"
)
==
"
foo
"
class
TestWordList
(
object
):
def
test_create_wordlist
(
self
,
tmpdir
):
# we can create `WordList` objects.
in_file
=
tmpdir
.
mkdir
(
"
work
"
).
join
(
"
mywordlist
"
)
in_file
.
write
(
"
foo
\n
"
)
wlist
=
WordList
(
str
(
in_file
))
assert
wlist
is
not
None
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment