Waylan Limberg avatar Waylan Limberg committed 988eed8

Remove old base.py nose code. I thought this was gone a long tiem ago.

Comments (0)

Files changed (1)

markdown/tests/base.py

-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')]
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.