Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
split_doc.py --strict makes it required. - add in_progress notification - Make title detection smarter
- Loading branch information
Andy Chu
committed
Oct 31, 2019
1 parent
6155a0f
commit 58734a5
Showing
8 changed files
with
199 additions
and
73 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
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,102 @@ | ||
#!/usr/bin/env python2 | ||
""" | ||
split_doc_test.py: Tests for split_doc.py | ||
""" | ||
from __future__ import print_function | ||
|
||
import unittest | ||
from cStringIO import StringIO | ||
|
||
import split_doc # module under test | ||
|
||
|
||
class FooTest(unittest.TestCase): | ||
|
||
def testStrict(self): | ||
entry_f = StringIO('''\ | ||
Title | ||
===== | ||
hello | ||
''') | ||
|
||
meta_f = StringIO() | ||
content_f = StringIO() | ||
|
||
self.assertRaises(RuntimeError, | ||
split_doc.SplitDocument, {}, entry_f, meta_f, content_f, strict=True) | ||
|
||
print(meta_f.getvalue()) | ||
print(content_f.getvalue()) | ||
|
||
def testMetadataAndTitle(self): | ||
print('_' * 40) | ||
print() | ||
|
||
entry_f = StringIO('''\ | ||
--- | ||
foo: bar | ||
--- | ||
Title | ||
===== | ||
hello | ||
''') | ||
|
||
meta_f = StringIO() | ||
content_f = StringIO() | ||
|
||
split_doc.SplitDocument({'default': 'd'}, entry_f, meta_f, content_f) | ||
|
||
print(meta_f.getvalue()) | ||
print(content_f.getvalue()) | ||
|
||
def testMetadataAndTitleNoSpace(self): | ||
print('_' * 40) | ||
print() | ||
|
||
entry_f = StringIO('''\ | ||
--- | ||
foo: bar | ||
--- | ||
No Space Before Title | ||
===================== | ||
hello | ||
''') | ||
|
||
meta_f = StringIO() | ||
content_f = StringIO() | ||
|
||
split_doc.SplitDocument({'default': 'd'}, entry_f, meta_f, content_f) | ||
|
||
print(meta_f.getvalue()) | ||
print(content_f.getvalue()) | ||
|
||
def testTitleOnly(self): | ||
print('_' * 40) | ||
print() | ||
|
||
entry_f = StringIO('''\ | ||
No Space Before Title | ||
===================== | ||
hello | ||
''') | ||
|
||
meta_f = StringIO() | ||
content_f = StringIO() | ||
|
||
split_doc.SplitDocument({'default': 'd'}, entry_f, meta_f, content_f) | ||
|
||
print(meta_f.getvalue()) | ||
print(content_f.getvalue()) | ||
|
||
|
||
if __name__ == '__main__': | ||
unittest.main() |
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
File renamed without changes.
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,3 +1,7 @@ | ||
--- | ||
in_progress: yes | ||
--- | ||
|
||
Oil Options | ||
=========== | ||
|
||
|