From 326457dda6da647565806f6363d9fcf17b52fe64 Mon Sep 17 00:00:00 2001 From: Zach Smith Date: Mon, 28 Dec 2015 12:06:36 -0500 Subject: (minor) Update hypothesis versions, insert needed newline in docs --- AUTHORS | 1 + pycco/main.py | 3 +++ requirements.test.txt | 2 +- tests/test_pycco.py | 36 +++++++++++++++++++++++------------- 4 files changed, 28 insertions(+), 14 deletions(-) diff --git a/AUTHORS b/AUTHORS index 442c482..b6faf28 100644 --- a/AUTHORS +++ b/AUTHORS @@ -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) -- cgit v1.2.1