-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
grab wordlist for Windows; speed up tests; .gitignore
- Loading branch information
1 parent
eb1a650
commit e1ed970
Showing
5 changed files
with
30 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,10 @@ | ||
import os | ||
import random | ||
from math import log, ceil | ||
from string import ascii_lowercase, ascii_uppercase, digits, punctuation | ||
from datetime import datetime | ||
from collections import OrderedDict | ||
from urllib.request import urlretrieve | ||
|
||
from django.utils.text import slugify | ||
|
||
|
@@ -14,6 +16,19 @@ | |
|
||
FACTORY_USER_PASSWORD = "f:O>r<5H%UsBu" | ||
|
||
if os.name == "posix": | ||
dictionary_path = '/usr/share/dict/words' | ||
else: | ||
# if we're not on a Unix-like system (!?) | ||
dictionary_path = os.path.join('static', 'libs', 'words') | ||
# and haven't already done so | ||
if not os.path.exists(dictionary_path): | ||
# let's just grab a wordlist from the internet | ||
urlretrieve("http://www.cs.duke.edu/~ola/ap/linuxwords") | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
zackmdavis
Author
Owner
|
||
|
||
with open(dictionary_path) as dictionary: | ||
WORDS = [word for word in dictionary.read().split('\n') if "'" not in word] | ||
|
||
def romanize_sort_of(n): | ||
pseudo_digits = OrderedDict( | ||
((100, 'C'), (50, 'L'), (10, 'X'), (5, 'V'), (1, 'I')) | ||
|
@@ -64,9 +79,6 @@ class Meta: | |
published_at = datetime.now() | ||
|
||
|
||
with open('/usr/share/dict/words') as dictionary: | ||
WORDS = [word for word in dictionary.read().split('\n') if "'" not in word] | ||
|
||
class TagFactory(factory.DjangoModelFactory): | ||
class Meta: | ||
model = Tag | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@cookjw I think this should let you use the
TagFactory
(and tests that depend on it)?