/[thuban]/branches/WIP-pyshapelib-bramz/test/support.py
ViewVC logotype

Diff of /branches/WIP-pyshapelib-bramz/test/support.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 904 by jonathan, Wed May 14 11:16:38 2003 UTC revision 956 by bh, Wed May 21 17:11:17 2003 UTC
# Line 108  class FileTestMixin: Line 108  class FileTestMixin:
108          return create_temp_dir()          return create_temp_dir()
109    
110    
111    
112    class FileLoadTestCase(unittest.TestCase, FileTestMixin):
113    
114        """Base class for test case that test loading files.
115    
116        This base class provides some common infrastructure for testing the
117        reading of files.
118    
119        Each test case should be its own class derived from this one. There
120        is one file associated with each class. The contents are defined by
121        the file_contents class attribute and its name by the filename
122        method.
123    
124        Derived classes usually only have to provide appropriate values for
125        the file_contents and file_extension class attributes.
126        """
127    
128        file_contents = None
129        file_extension = ""
130    
131        def filename(self):
132            """Return the name of the test file to use.
133    
134            The default implementation simply calls self.volatile_file_name
135            with a basename derived from the class name by stripping off a
136            leading 'test_' and appending self.file_extension.
137            """
138            name = self.__class__.__name__
139            if name.startswith("test_"):
140                name = name[5:]
141            return self.temp_file_name(name + self.file_extension)
142    
143        def setUp(self):
144            """Create the volatile file for the test.
145    
146            Write self.contents (which should be a string) to the file named
147            by self.filename().
148            """
149            filename = self.filename()
150            file = open(filename, "w")
151            file.write(self.file_contents)
152            file.close()
153    
154    
155  class FloatComparisonMixin:  class FloatComparisonMixin:
156    
157      """      """

Legend:
Removed from v.904  
changed lines
  Added in v.956

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26