diff options
author | Zach Smith <zd@zdsmith.com> | 2015-12-28 12:06:36 -0500 |
---|---|---|
committer | Zach Smith <zd@zdsmith.com> | 2015-12-28 12:06:36 -0500 |
commit | 326457dda6da647565806f6363d9fcf17b52fe64 (patch) | |
tree | ec1e0d5b23c79aa5f9bb19dbf5fc6f65882e7e89 | |
parent | 239816deb0db2a3136b5442bca7422faf67d953d (diff) | |
download | pycco-326457dda6da647565806f6363d9fcf17b52fe64.tar.gz |
(minor) Update hypothesis versions, insert needed newline in docs
-rw-r--r-- | AUTHORS | 1 | ||||
-rw-r--r-- | pycco/main.py | 3 | ||||
-rw-r--r-- | requirements.test.txt | 2 | ||||
-rw-r--r-- | tests/test_pycco.py | 36 |
4 files changed, 28 insertions, 14 deletions
@@ -5,5 +5,6 @@ Christopher Gateley Jack Miller Morgan Goose Nick Fitzgerald +Zach Smith goosemo khamidou diff --git a/pycco/main.py b/pycco/main.py index c9a3612..22f889a 100644 --- a/pycco/main.py +++ b/pycco/main.py @@ -64,6 +64,7 @@ def parse(code, language): Given a string of source code, parse out each comment and the code that follows it, and create an individual **section** for it. Sections take the form: + { "docs_text": ..., "docs_html": ..., "code_text": ..., @@ -252,6 +253,8 @@ def highlight(sections, language, preserve_paths=True, outdir=None): outdir=outdir)) section["num"] = i + return sections + # === HTML Code generation === diff --git a/requirements.test.txt b/requirements.test.txt index 8439fc2..5db5948 100644 --- a/requirements.test.txt +++ b/requirements.test.txt @@ -1,3 +1,3 @@ -hypothesis==1.14.0 +hypothesis==1.18.1 pytest-cov==2.2.0 coveralls==1.1 diff --git a/tests/test_pycco.py b/tests/test_pycco.py index 8136c03..be4e620 100644 --- a/tests/test_pycco.py +++ b/tests/test_pycco.py @@ -108,19 +108,6 @@ def test_ensure_directory(dir_name): p.ensure_directory(tempdir) assert os.path.isdir(safe_name) -# The following functions get good test coverage, but effort should be put into -# decomposing the functions they test and actually testing their output. - - -def test_generate_documentation(): - p.generate_documentation(PYCCO_SOURCE, outdir=tempfile.gettempdir()) - - -@given(booleans(), choices()) -def test_process(preserve_paths, choice): - lang_name = choice([l["name"] for l in p.languages.values()]) - p.process([PYCCO_SOURCE], preserve_paths=preserve_paths, outdir=tempfile.gettempdir(), language=lang_name) - def test_ensure_multiline_string_support(): code = '''x = """ @@ -139,3 +126,26 @@ def x(): assert docs_code_tuple_list[0]['docs_text'] == '' assert "#" not in docs_code_tuple_list[1]['docs_text'] + + +def test_indented_block(): + + code = '''""" +To install Pycco, simply + + pip install pycco +""" +''' + parsed = p.parse(code, PYTHON) + highlighted = p.highlight(parsed, PYTHON, outdir=tempfile.gettempdir()) + print highlighted + + +def test_generate_documentation(): + p.generate_documentation(PYCCO_SOURCE, outdir=tempfile.gettempdir()) + + +@given(booleans(), choices()) +def test_process(preserve_paths, choice): + lang_name = choice([l["name"] for l in p.languages.values()]) + p.process([PYCCO_SOURCE], preserve_paths=preserve_paths, outdir=tempfile.gettempdir(), language=lang_name) |