-
Notifications
You must be signed in to change notification settings - Fork 348
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #75 from jsvine/linewise
Accept file-like objects, and to discard original
- Loading branch information
Showing
5 changed files
with
59 additions
and
12 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,2 +1,2 @@ | ||
VERSION_TUPLE = (0, 6, 0) | ||
VERSION_TUPLE = (0, 6, 1) | ||
__version__ = ".".join(map(str, VERSION_TUPLE)) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import unittest | ||
import markovify | ||
import sys, os | ||
import operator | ||
|
||
class MarkovifyTest(unittest.TestCase): | ||
|
||
def test_simple(self): | ||
with open(os.path.join(os.path.dirname(__file__), "texts/sherlock.txt")) as f: | ||
sherlock_model = markovify.Text(f) | ||
sent = sherlock_model.make_sentence() | ||
assert sent is not None | ||
assert len(sent) != 0 | ||
|
||
def test_without_retaining(self): | ||
with open(os.path.join(os.path.dirname(__file__), "texts/senate-bills.txt")) as f: | ||
senate_model = markovify.Text(f, retain_original=False) | ||
sent = senate_model.make_sentence() | ||
assert sent is not None | ||
assert len(sent) != 0 | ||
|
||
if __name__ == '__main__': | ||
unittest.main() | ||
|
||
|