aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWaylan Limberg <waylan@gmail.com>2009-06-05 22:18:41 -0400
committerWaylan Limberg <waylan@gmail.com>2009-06-05 22:25:54 -0400
commit048b9ead4428b8942900ece9d47462d3be5a48ea (patch)
tree83c4e5cf2216c9caf81cc4d9168ff41a0649fc41
parent678c4509c81c7ff9b68cff5eabcc684ea68c8253 (diff)
downloadmarkdown-048b9ead4428b8942900ece9d47462d3be5a48ea.tar.gz
markdown-048b9ead4428b8942900ece9d47462d3be5a48ea.tar.bz2
markdown-048b9ead4428b8942900ece9d47462d3be5a48ea.zip
Remove old base.py nose code. I thought this was gone a long tiem ago.
-rw-r--r--markdown/tests/base.py62
1 files changed, 0 insertions, 62 deletions
diff --git a/markdown/tests/base.py b/markdown/tests/base.py
deleted file mode 100644
index 9e70996..0000000
--- a/markdown/tests/base.py
+++ /dev/null
@@ -1,62 +0,0 @@
-import os, codecs
-import markdown
-from nose.tools import assert_equal
-import difflib
-from plugins import MdSyntaxError
-
-class SyntaxBase:
- """
- Generator that steps through all files in a dir and runs each text file
- (*.txt) as a seperate unit test.
-
- Each subclass of SyntaxBase should define `dir` as a string containing the
- name of the directory which holds the test files. For example:
-
- dir = "path/to/mytests"
-
- A subclass may redefine the `setUp` method to create a custom `Markdown`
- instance specific to that batch of tests.
-
- """
-
- dir = ""
-
- def __init__(self):
- self.files = [x.replace(".txt", "")
- for x in os.listdir(self.dir) if x.endswith(".txt")]
-
- def setUp(self):
- """
- Create Markdown instance.
-
- Override this method to create a custom `Markdown` instance assigned to
- `self.md`. For example:
-
- self.md = markdown.Markdown(extensions=["footnotes"], safe_mode="replace")
-
- """
- self.md = markdown.Markdown()
-
- def tearDown(self):
- """ tearDown is not implemented. """
- pass
-
- def test_syntax(self):
- for file in self.files:
- yield self.check_syntax, file
-
- def check_syntax(self, file):
- input_file = os.path.join(self.dir, file + ".txt")
- input = codecs.open(input_file, encoding="utf-8").read()
- output_file = os.path.join(self.dir, file + ".html")
- expected_output = codecs.open(output_file, encoding="utf-8").read()
- output = self.normalize(self.md.convert(input))
- diff = [l for l in difflib.unified_diff(self.normalize(expected_output),
- output, output_file,
- 'actual_output.html', n=3)]
- if diff:
- #assert False,
- raise MdSyntaxError('Output from "%s" failed to match expected output.\n\n%s' % (input_file, ''.join(diff)))
-
- def normalize(self, text):
- return ['%s\n' % l for l in text.strip().split('\n')]