aboutsummaryrefslogtreecommitdiffstats
path: root/markdown
diff options
context:
space:
mode:
authorWaylan Limberg <waylan.limberg@icloud.com>2015-03-14 23:22:10 -0400
committerWaylan Limberg <waylan.limberg@icloud.com>2018-01-13 15:43:54 -0500
commit9ea3bdefbb62165c5c060852c60bfb5acd2574f1 (patch)
tree70d14a172fe302d5b233fe8ad70efc2713d1cae6 /markdown
parent3fad73031e544de6c9f74621de923da3806a6c21 (diff)
downloadmarkdown-9ea3bdefbb62165c5c060852c60bfb5acd2574f1.tar.gz
markdown-9ea3bdefbb62165c5c060852c60bfb5acd2574f1.tar.bz2
markdown-9ea3bdefbb62165c5c060852c60bfb5acd2574f1.zip
Improve test coverage.
Diffstat (limited to 'markdown')
-rw-r--r--markdown/__init__.py2
-rw-r--r--markdown/__version__.py30
-rw-r--r--markdown/core.py9
-rw-r--r--markdown/extensions/abbr.py2
-rw-r--r--markdown/extensions/admonition.py2
-rw-r--r--markdown/extensions/attr_list.py2
-rw-r--r--markdown/extensions/codehilite.py2
-rw-r--r--markdown/extensions/def_list.py2
-rw-r--r--markdown/extensions/extra.py2
-rw-r--r--markdown/extensions/fenced_code.py2
-rw-r--r--markdown/extensions/footnotes.py2
-rw-r--r--markdown/extensions/meta.py2
-rw-r--r--markdown/extensions/nl2br.py2
-rw-r--r--markdown/extensions/sane_lists.py2
-rw-r--r--markdown/extensions/smart_strong.py2
-rw-r--r--markdown/extensions/smarty.py2
-rw-r--r--markdown/extensions/tables.py2
-rw-r--r--markdown/extensions/toc.py4
-rw-r--r--markdown/extensions/wikilinks.py2
19 files changed, 22 insertions, 53 deletions
diff --git a/markdown/__init__.py b/markdown/__init__.py
index 3769496..5e7c1de 100644
--- a/markdown/__init__.py
+++ b/markdown/__init__.py
@@ -46,7 +46,7 @@ __all__ = ['Markdown', 'markdown', 'markdownFromFile']
__version_info__ = (3, 0, 0, 'alpha', 0)
-def _get_version():
+def _get_version(): # pragma: no cover
" Returns a PEP 386-compliant version number from version_info. "
assert len(__version_info__) == 5
assert __version_info__[3] in ('alpha', 'beta', 'rc', 'final')
diff --git a/markdown/__version__.py b/markdown/__version__.py
deleted file mode 100644
index b01909e..0000000
--- a/markdown/__version__.py
+++ /dev/null
@@ -1,30 +0,0 @@
-#
-# markdown/__version__.py
-#
-# version_info should conform to PEP 386
-# (major, minor, micro, alpha/beta/rc/final, #)
-# (1, 1, 2, 'alpha', 0) => "1.1.2.dev"
-# (1, 2, 0, 'beta', 2) => "1.2b2"
-version_info = (3, 0, 0, 'alpha', 0)
-
-
-def _get_version():
- " Returns a PEP 386-compliant version number from version_info. "
- assert len(version_info) == 5
- assert version_info[3] in ('alpha', 'beta', 'rc', 'final')
-
- parts = 2 if version_info[2] == 0 else 3
- main = '.'.join(map(str, version_info[:parts]))
-
- sub = ''
- if version_info[3] == 'alpha' and version_info[4] == 0:
- # TODO: maybe append some sort of git info here??
- sub = '.dev'
- elif version_info[3] != 'final':
- mapping = {'alpha': 'a', 'beta': 'b', 'rc': 'c'}
- sub = mapping[version_info[3]] + str(version_info[4])
-
- return str(main + sub)
-
-
-version = _get_version()
diff --git a/markdown/core.py b/markdown/core.py
index ce5c333..7424781 100644
--- a/markdown/core.py
+++ b/markdown/core.py
@@ -150,8 +150,7 @@ class Markdown(object):
return ext(**configs)
# Get class name (if provided): `path.to.module:ClassName`
- ext_name, class_name = ext_name.split(':', 1) \
- if ':' in ext_name else (ext_name, '')
+ ext_name, class_name = ext_name.split(':', 1) if ':' in ext_name else (ext_name, '')
try:
module = importlib.import_module(ext_name)
@@ -238,7 +237,7 @@ class Markdown(object):
try:
source = util.text_type(source)
- except UnicodeDecodeError as e:
+ except UnicodeDecodeError as e: # pragma: no cover
# Customise error message while maintaining original trackback
e.reason += '. -- Note: Markdown only accepts unicode input!'
raise
@@ -313,7 +312,7 @@ class Markdown(object):
input_file.close()
else:
text = sys.stdin.read()
- if not isinstance(text, util.text_type):
+ if not isinstance(text, util.text_type): # pragma: no cover
text = text.decode(encoding)
text = text.lstrip('\ufeff') # remove the byte-order mark
@@ -340,7 +339,7 @@ class Markdown(object):
try:
# Write bytes directly to buffer (Python 3).
sys.stdout.buffer.write(html)
- except AttributeError:
+ except AttributeError: # pragma: no cover
# Probably Python 2, which works with bytes by default.
sys.stdout.write(html)
diff --git a/markdown/extensions/abbr.py b/markdown/extensions/abbr.py
index ec2428a..e6aff7b 100644
--- a/markdown/extensions/abbr.py
+++ b/markdown/extensions/abbr.py
@@ -90,5 +90,5 @@ class AbbrPattern(Pattern):
return abbr
-def makeExtension(*args, **kwargs):
+def makeExtension(*args, **kwargs): # pragma: no cover
return AbbrExtension(*args, **kwargs)
diff --git a/markdown/extensions/admonition.py b/markdown/extensions/admonition.py
index 2e83900..1ac4a20 100644
--- a/markdown/extensions/admonition.py
+++ b/markdown/extensions/admonition.py
@@ -92,5 +92,5 @@ class AdmonitionProcessor(BlockProcessor):
return klass, title
-def makeExtension(*args, **kwargs):
+def makeExtension(*args, **kwargs): # pragma: no cover
return AdmonitionExtension(*args, **kwargs)
diff --git a/markdown/extensions/attr_list.py b/markdown/extensions/attr_list.py
index 6ce73a6..ea36d37 100644
--- a/markdown/extensions/attr_list.py
+++ b/markdown/extensions/attr_list.py
@@ -168,5 +168,5 @@ class AttrListExtension(Extension):
)
-def makeExtension(*args, **kwargs):
+def makeExtension(*args, **kwargs): # pragma: no cover
return AttrListExtension(*args, **kwargs)
diff --git a/markdown/extensions/codehilite.py b/markdown/extensions/codehilite.py
index 9c91c37..e30c7ba 100644
--- a/markdown/extensions/codehilite.py
+++ b/markdown/extensions/codehilite.py
@@ -260,5 +260,5 @@ class CodeHiliteExtension(Extension):
md.registerExtension(self)
-def makeExtension(*args, **kwargs):
+def makeExtension(*args, **kwargs): # pragma: no cover
return CodeHiliteExtension(*args, **kwargs)
diff --git a/markdown/extensions/def_list.py b/markdown/extensions/def_list.py
index 54fc064..cbbffdc 100644
--- a/markdown/extensions/def_list.py
+++ b/markdown/extensions/def_list.py
@@ -111,5 +111,5 @@ class DefListExtension(Extension):
'>ulist')
-def makeExtension(*args, **kwargs):
+def makeExtension(*args, **kwargs): # pragma: no cover
return DefListExtension(*args, **kwargs)
diff --git a/markdown/extensions/extra.py b/markdown/extensions/extra.py
index cea18ed..33ee4b2 100644
--- a/markdown/extensions/extra.py
+++ b/markdown/extensions/extra.py
@@ -68,7 +68,7 @@ class ExtraExtension(Extension):
r'^(p|h[1-6]|li|dd|dt|td|th|legend|address)$', re.IGNORECASE)
-def makeExtension(*args, **kwargs):
+def makeExtension(*args, **kwargs): # pragma: no cover
return ExtraExtension(*args, **kwargs)
diff --git a/markdown/extensions/fenced_code.py b/markdown/extensions/fenced_code.py
index 0975bb5..01aa605 100644
--- a/markdown/extensions/fenced_code.py
+++ b/markdown/extensions/fenced_code.py
@@ -109,5 +109,5 @@ class FencedBlockPreprocessor(Preprocessor):
return txt
-def makeExtension(*args, **kwargs):
+def makeExtension(*args, **kwargs): # pragma: no cover
return FencedCodeExtension(*args, **kwargs)
diff --git a/markdown/extensions/footnotes.py b/markdown/extensions/footnotes.py
index de3fc17..6ac92ab 100644
--- a/markdown/extensions/footnotes.py
+++ b/markdown/extensions/footnotes.py
@@ -426,6 +426,6 @@ class FootnotePostprocessor(Postprocessor):
return text.replace(NBSP_PLACEHOLDER, "&#160;")
-def makeExtension(*args, **kwargs):
+def makeExtension(*args, **kwargs): # pragma: no cover
""" Return an instance of the FootnoteExtension """
return FootnoteExtension(*args, **kwargs)
diff --git a/markdown/extensions/meta.py b/markdown/extensions/meta.py
index 7902bd4..33e13fb 100644
--- a/markdown/extensions/meta.py
+++ b/markdown/extensions/meta.py
@@ -74,5 +74,5 @@ class MetaPreprocessor(Preprocessor):
return lines
-def makeExtension(*args, **kwargs):
+def makeExtension(*args, **kwargs): # pragma: no cover
return MetaExtension(*args, **kwargs)
diff --git a/markdown/extensions/nl2br.py b/markdown/extensions/nl2br.py
index a4c0fab..1d23c99 100644
--- a/markdown/extensions/nl2br.py
+++ b/markdown/extensions/nl2br.py
@@ -31,5 +31,5 @@ class Nl2BrExtension(Extension):
md.inlinePatterns.add('nl', br_tag, '_end')
-def makeExtension(*args, **kwargs):
+def makeExtension(*args, **kwargs): # pragma: no cover
return Nl2BrExtension(*args, **kwargs)
diff --git a/markdown/extensions/sane_lists.py b/markdown/extensions/sane_lists.py
index 651b12b..4b118af 100644
--- a/markdown/extensions/sane_lists.py
+++ b/markdown/extensions/sane_lists.py
@@ -51,5 +51,5 @@ class SaneListExtension(Extension):
md.parser.blockprocessors['ulist'] = SaneUListProcessor(md.parser)
-def makeExtension(*args, **kwargs):
+def makeExtension(*args, **kwargs): # pragma: no cover
return SaneListExtension(*args, **kwargs)
diff --git a/markdown/extensions/smart_strong.py b/markdown/extensions/smart_strong.py
index 9349f41..7070318 100644
--- a/markdown/extensions/smart_strong.py
+++ b/markdown/extensions/smart_strong.py
@@ -37,5 +37,5 @@ class SmartEmphasisExtension(Extension):
)
-def makeExtension(*args, **kwargs):
+def makeExtension(*args, **kwargs): # pragma: no cover
return SmartEmphasisExtension(*args, **kwargs)
diff --git a/markdown/extensions/smarty.py b/markdown/extensions/smarty.py
index ba5b6b6..6add986 100644
--- a/markdown/extensions/smarty.py
+++ b/markdown/extensions/smarty.py
@@ -264,5 +264,5 @@ class SmartyExtension(Extension):
md.ESCAPED_CHARS.extend(['"', "'"])
-def makeExtension(*args, **kwargs):
+def makeExtension(*args, **kwargs): # pragma: no cover
return SmartyExtension(*args, **kwargs)
diff --git a/markdown/extensions/tables.py b/markdown/extensions/tables.py
index 6d28aef..dc459f3 100644
--- a/markdown/extensions/tables.py
+++ b/markdown/extensions/tables.py
@@ -223,5 +223,5 @@ class TableExtension(Extension):
'<hashheader')
-def makeExtension(*args, **kwargs):
+def makeExtension(*args, **kwargs): # pragma: no cover
return TableExtension(*args, **kwargs)
diff --git a/markdown/extensions/toc.py b/markdown/extensions/toc.py
index f884f9b..d2ea45e 100644
--- a/markdown/extensions/toc.py
+++ b/markdown/extensions/toc.py
@@ -178,7 +178,7 @@ class TocTreeprocessor(Treeprocessor):
c.text = ""
for elem in c:
anchor.append(elem)
- while c:
+ while len(c):
c.remove(c[0])
c.append(anchor)
@@ -304,5 +304,5 @@ class TocExtension(Extension):
self.md.toc = ''
-def makeExtension(*args, **kwargs):
+def makeExtension(*args, **kwargs): # pragma: no cover
return TocExtension(*args, **kwargs)
diff --git a/markdown/extensions/wikilinks.py b/markdown/extensions/wikilinks.py
index ff16494..3f40608 100644
--- a/markdown/extensions/wikilinks.py
+++ b/markdown/extensions/wikilinks.py
@@ -85,5 +85,5 @@ class WikiLinks(Pattern):
return base_url, end_url, html_class
-def makeExtension(*args, **kwargs):
+def makeExtension(*args, **kwargs): # pragma: no cover
return WikiLinkExtension(*args, **kwargs)