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 #11 from wgxli/develop
Additional unit tests, under-the-hood changes
- Loading branch information
Showing
19 changed files
with
336 additions
and
37 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,4 +4,3 @@ docs/build | |
__pycache__/ | ||
.coverage | ||
cover | ||
run_tests.bat |
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 @@ | ||
sphinx-build -b html docs/source docs/build |
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 @@ | ||
nosetests --with-coverage --cover-branch --cover-html --cover-package=simpletex |
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
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,6 @@ | ||
from simpletex import write, dump | ||
from simpletex.sequences import Description | ||
|
||
with Description(): | ||
write('asdf', 'fdsa') | ||
print(dump()) |
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 |
---|---|---|
@@ -0,0 +1,69 @@ | ||
import unittest | ||
import string | ||
|
||
from simpletex import write, clear, dump, save | ||
from simpletex.document import Document, Section, Subsection | ||
|
||
|
||
SAMPLE_TEXT = 'simpletex' | ||
SAMPLE_HEADING = 'Heading Text' | ||
|
||
HEADER = '\n'.join([r'\documentclass[12pt]{article}', '', r'\usepackage[utf8]{inputenc}', '', r'\begin{document}']) | ||
FOOTER = r'\end{document}' | ||
|
||
|
||
class TestDocument(unittest.TestCase): | ||
def test_document(self): | ||
with Document(): | ||
write(SAMPLE_TEXT) | ||
expected_string = '\n'.join([ | ||
HEADER, | ||
'\t' + SAMPLE_TEXT, | ||
FOOTER | ||
]) | ||
self.assertEqual(dump(), | ||
expected_string) | ||
clear() | ||
|
||
def tearDown(self): | ||
clear() | ||
|
||
|
||
class TestSection(unittest.TestCase): | ||
def test_section(self): | ||
with Document(): | ||
with Section(SAMPLE_HEADING): | ||
write(SAMPLE_TEXT) | ||
expected_string = '\n'.join([ | ||
HEADER, | ||
'\t\\section{' + SAMPLE_HEADING + '}', | ||
'\t\t' + SAMPLE_TEXT, | ||
FOOTER | ||
]) | ||
self.assertEqual(dump(), | ||
expected_string) | ||
clear() | ||
|
||
def tearDown(self): | ||
clear() | ||
|
||
|
||
class TestSubsection(unittest.TestCase): | ||
def test_subsection(self): | ||
with Document(): | ||
with Subsection(SAMPLE_HEADING): | ||
write(SAMPLE_TEXT) | ||
expected_string = '\n'.join([ | ||
HEADER, | ||
'\t\\subsection{' + SAMPLE_HEADING + '}', | ||
'\t\t' + SAMPLE_TEXT, | ||
FOOTER | ||
]) | ||
self.assertEqual(dump(), | ||
expected_string) | ||
clear() | ||
|
||
def tearDown(self): | ||
clear() | ||
|
||
|
Oops, something went wrong.