aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--markdown/__init__.py4
-rw-r--r--markdown/blockprocessors.py4
-rw-r--r--markdown/extensions/attr_list.py2
-rw-r--r--markdown/extensions/codehilite.py2
-rw-r--r--markdown/extensions/tables.py2
-rw-r--r--markdown/inlinepatterns.py12
-rw-r--r--markdown/odict.py4
-rw-r--r--markdown/postprocessors.py2
-rw-r--r--markdown/preprocessors.py2
-rw-r--r--markdown/serializers.py18
-rw-r--r--markdown/treeprocessors.py2
-rw-r--r--markdown/util.py9
12 files changed, 32 insertions, 31 deletions
diff --git a/markdown/__init__.py b/markdown/__init__.py
index 378f873..740e932 100644
--- a/markdown/__init__.py
+++ b/markdown/__init__.py
@@ -112,7 +112,7 @@ class Markdown(object):
if pos[c] not in kwargs:
kwargs[pos[c]] = arg
c += 1
- if c == len(pos):
+ if c == len(pos): #pragma: no cover
# ignore any additional args
break
@@ -303,7 +303,7 @@ class Markdown(object):
start = output.index('<%s>'%self.doc_tag)+len(self.doc_tag)+2
end = output.rindex('</%s>'%self.doc_tag)
output = output[start:end].strip()
- except ValueError:
+ except ValueError: #pragma: no cover
if output.strip().endswith('<%s />'%self.doc_tag):
# We have an empty document
output = ''
diff --git a/markdown/blockprocessors.py b/markdown/blockprocessors.py
index 147ff0f..e8f6750 100644
--- a/markdown/blockprocessors.py
+++ b/markdown/blockprocessors.py
@@ -99,7 +99,7 @@ class BlockProcessor:
* ``block``: A block of text from the source which has been split at
blank lines.
"""
- pass
+ pass #pragma: no cover
def run(self, parent, blocks):
""" Run processor. Must be overridden by subclasses.
@@ -123,7 +123,7 @@ class BlockProcessor:
* ``parent``: A etree element which is the parent of the current block.
* ``blocks``: A list of all remaining blocks of the document.
"""
- pass
+ pass #pragma: no cover
class ListIndentProcessor(BlockProcessor):
diff --git a/markdown/extensions/attr_list.py b/markdown/extensions/attr_list.py
index 8b65f56..f0508cd 100644
--- a/markdown/extensions/attr_list.py
+++ b/markdown/extensions/attr_list.py
@@ -27,7 +27,7 @@ import re
try:
Scanner = re.Scanner
-except AttributeError:
+except AttributeError: #pragma: no cover
# must be on Python 2.4
from sre import Scanner
diff --git a/markdown/extensions/codehilite.py b/markdown/extensions/codehilite.py
index 428bd0c..f379da7 100644
--- a/markdown/extensions/codehilite.py
+++ b/markdown/extensions/codehilite.py
@@ -244,7 +244,7 @@ class CodeHiliteExtension(Extension):
if value == 'False': value = False
if value == 'None': value = None
- if key == 'force_linenos':
+ if key == 'force_linenos': #pragma: no cover
warnings.warn('The "force_linenos" config setting'
' to the CodeHilite extension is deprecrecated.'
' Use "linenums" instead.', DeprecationWarning)
diff --git a/markdown/extensions/tables.py b/markdown/extensions/tables.py
index ad52ec1..cfac0bc 100644
--- a/markdown/extensions/tables.py
+++ b/markdown/extensions/tables.py
@@ -71,7 +71,7 @@ class TableProcessor(BlockProcessor):
c = etree.SubElement(tr, tag)
try:
c.text = cells[i].strip()
- except IndexError:
+ except IndexError: #pragma: no cover
c.text = ""
if a:
c.set('align', a)
diff --git a/markdown/inlinepatterns.py b/markdown/inlinepatterns.py
index 9335748..9fed20d 100644
--- a/markdown/inlinepatterns.py
+++ b/markdown/inlinepatterns.py
@@ -178,7 +178,7 @@ class Pattern(object):
* m: A re match object containing a match of the pattern.
"""
- pass
+ pass #pragma: no cover
def type(self):
""" Return class name, to define pattern type """
@@ -188,9 +188,9 @@ class Pattern(object):
""" Return unescaped text given text with an inline placeholder. """
try:
stash = self.markdown.treeprocessors['inline'].stashed_nodes
- except KeyError:
+ except KeyError: #pragma: no cover
return text
- def itertext(el):
+ def itertext(el): #pragma: no cover
' Reimplement Element.itertext for older python versions '
tag = el.tag
if not isinstance(tag, util.string_type) and tag is not None:
@@ -293,7 +293,7 @@ class HtmlPattern(Pattern):
""" Return unescaped text given text with an inline placeholder. """
try:
stash = self.markdown.treeprocessors['inline'].stashed_nodes
- except KeyError:
+ except KeyError: #pragma: no cover
return text
def get_stash(m):
id = m.group(1)
@@ -350,7 +350,7 @@ class LinkPattern(Pattern):
try:
scheme, netloc, path, params, query, fragment = url = urlparse(url)
- except ValueError:
+ except ValueError: #pragma: no cover
# Bad url - so bad it couldn't be parsed.
return ''
@@ -360,7 +360,7 @@ class LinkPattern(Pattern):
# Not a known (allowed) scheme. Not safe.
return ''
- if netloc == '' and scheme not in locless_schemes:
+ if netloc == '' and scheme not in locless_schemes: #pragma: no cover
# This should not happen. Treat as suspect.
return ''
diff --git a/markdown/odict.py b/markdown/odict.py
index 68c1259..b158e06 100644
--- a/markdown/odict.py
+++ b/markdown/odict.py
@@ -82,11 +82,11 @@ class OrderedDict(dict):
for key in self.keyOrder:
yield self[key]
- if util.PY3:
+ if util.PY3: #pragma: no cover
items = _iteritems
keys = _iterkeys
values = _itervalues
- else:
+ else: #pragma: no cover
iteritems = _iteritems
iterkeys = _iterkeys
itervalues = _itervalues
diff --git a/markdown/postprocessors.py b/markdown/postprocessors.py
index 5f3f032..7b568ad 100644
--- a/markdown/postprocessors.py
+++ b/markdown/postprocessors.py
@@ -42,7 +42,7 @@ class Postprocessor(util.Processor):
(possibly modified) string.
"""
- pass
+ pass #pragma: no cover
class RawHtmlPostprocessor(Postprocessor):
diff --git a/markdown/preprocessors.py b/markdown/preprocessors.py
index 5bfca55..4a1fac5 100644
--- a/markdown/preprocessors.py
+++ b/markdown/preprocessors.py
@@ -41,7 +41,7 @@ class Preprocessor(util.Processor):
the (possibly modified) list of lines.
"""
- pass
+ pass #pragma: no cover
class NormalizeWhitespace(Preprocessor):
diff --git a/markdown/serializers.py b/markdown/serializers.py
index aa82806..72fcef6 100644
--- a/markdown/serializers.py
+++ b/markdown/serializers.py
@@ -42,9 +42,9 @@ from __future__ import unicode_literals
from . import util
ElementTree = util.etree.ElementTree
QName = util.etree.QName
-if hasattr(util.etree, 'test_comment'):
+if hasattr(util.etree, 'test_comment'): #pragma: no cover
Comment = util.etree.test_comment
-else:
+else: #prgama: no cover
Comment = util.etree.Comment
PI = util.etree.PI
ProcessingInstruction = util.etree.ProcessingInstruction
@@ -56,7 +56,7 @@ HTML_EMPTY = ("area", "base", "basefont", "br", "col", "frame", "hr",
try:
HTML_EMPTY = set(HTML_EMPTY)
-except NameError:
+except NameError: #pragma: no cover
pass
_namespace_map = {
@@ -73,7 +73,7 @@ _namespace_map = {
}
-def _raise_serialization_error(text):
+def _raise_serialization_error(text): #pragma: no cover
raise TypeError(
"cannot serialize %r (type %s)" % (text, type(text).__name__)
)
@@ -81,7 +81,7 @@ def _raise_serialization_error(text):
def _encode(text, encoding):
try:
return text.encode(encoding, "xmlcharrefreplace")
- except (TypeError, AttributeError):
+ except (TypeError, AttributeError): #pragma: no cover
_raise_serialization_error(text)
def _escape_cdata(text):
@@ -97,7 +97,7 @@ def _escape_cdata(text):
if ">" in text:
text = text.replace(">", "&gt;")
return text
- except (TypeError, AttributeError):
+ except (TypeError, AttributeError): #pragma: no cover
_raise_serialization_error(text)
@@ -115,7 +115,7 @@ def _escape_attrib(text):
if "\n" in text:
text = text.replace("\n", "&#10;")
return text
- except (TypeError, AttributeError):
+ except (TypeError, AttributeError): #pragma: no cover
_raise_serialization_error(text)
def _escape_attrib_html(text):
@@ -130,7 +130,7 @@ def _escape_attrib_html(text):
if "\"" in text:
text = text.replace("\"", "&quot;")
return text
- except (TypeError, AttributeError):
+ except (TypeError, AttributeError): #pragma: no cover
_raise_serialization_error(text)
@@ -240,7 +240,7 @@ def _namespaces(elem, default_namespace=None):
"default_namespace option"
)
qnames[qname] = qname
- except TypeError:
+ except TypeError: #pragma: no cover
_raise_serialization_error(qname)
# populate qname and namespaces table
diff --git a/markdown/treeprocessors.py b/markdown/treeprocessors.py
index 32b73b1..113ad3c 100644
--- a/markdown/treeprocessors.py
+++ b/markdown/treeprocessors.py
@@ -38,7 +38,7 @@ class Treeprocessor(util.Processor):
object, and the existing root ElementTree will be replaced, or it can
modify the current tree and return None.
"""
- pass
+ pass #pragma: no cover
class InlineProcessor(Treeprocessor):
diff --git a/markdown/util.py b/markdown/util.py
index edb2588..cdad775 100644
--- a/markdown/util.py
+++ b/markdown/util.py
@@ -10,11 +10,11 @@ Python 3 Stuff
"""
PY3 = sys.version_info[0] == 3
-if PY3:
+if PY3: #pragma: no cover
string_type = str
text_type = str
int2str = chr
-else:
+else: #pragma: no cover
string_type = basestring
text_type = unicode
int2str = unichr
@@ -58,14 +58,15 @@ RTL_BIDI_RANGES = ( ('\u0590', '\u07FF'),
# Extensions should use "markdown.util.etree" instead of "etree" (or do `from
# markdown.util import etree`). Do not import it by yourself.
-try: # Is the C implementation of ElementTree available?
+try: #pragma: no cover
+ # Is the C implementation of ElementTree available?
import xml.etree.cElementTree as etree
from xml.etree.ElementTree import Comment
# Serializers (including ours) test with non-c Comment
etree.test_comment = Comment
if etree.VERSION < "1.0.5":
raise RuntimeError("cElementTree version 1.0.5 or higher is required.")
-except (ImportError, RuntimeError):
+except (ImportError, RuntimeError): #pragma: no cover
# Use the Python implementation of ElementTree?
import xml.etree.ElementTree as etree
if etree.VERSION < "1.1":