Changeset 344
- Timestamp:
- 08/26/10 14:58:50
- Files:
-
- spongenet/trunk/mini_andi_expand_config.py (added)
- spongenet/trunk/spongenet/__init.py__ (modified) (1 diff)
- spongenet/trunk/spongenet/expand.py (modified) (17 diffs)
- spongenet/trunk/spongenet/tests/__init.py__ (added)
- spongenet/trunk/spongenet/tests/expand/__init.py__ (added)
- spongenet/trunk/spongenet/tests/expand/bad_config.py (modified) (1 diff)
- spongenet/trunk/spongenet/tests/expand/config.py (modified) (1 diff)
- spongenet/trunk/spongenet/tests/expand/empty_config.py (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
spongenet/trunk/spongenet/__init.py__
r337 r344 1 #!/usr/bin/env python 2 1 3 """Package to process sponge data files.""" spongenet/trunk/spongenet/expand.py
r343 r344 1 #!/usr/bin/env python 2 1 3 """ 2 4 Expand zipped sponge data files. … … 28 30 from StringIO import StringIO 29 31 30 usage= "\n".join(__doc__.splitlines()[3:8])31 test_path= "tests/expand"32 USAGE = "\n".join(__doc__.splitlines()[3:8]) 33 TEST_PATH = "tests/expand" 32 34 33 35 … … 61 63 >>> _config_path = config_path() 62 64 >>> sys.stdout = save_stdout 63 >>> usage== temp_stdout.getvalue()[:-1]65 >>> USAGE == temp_stdout.getvalue()[:-1] 64 66 True 65 67 … … 72 74 >>> _config_path = config_path() 73 75 >>> sys.stdout = save_stdout 74 >>> usage== temp_stdout.getvalue()[:-1]76 >>> USAGE == temp_stdout.getvalue()[:-1] 75 77 True 76 78 … … 83 85 ... os.path.dirname( 84 86 ... os.path.abspath(__file__)), 85 ... test_path)87 ... TEST_PATH) 86 88 >>> sys.argv = ["", _config_path] 87 89 >>> _config_path = config_path() 88 90 >>> sys.stdout = save_stdout 89 >>> usage== temp_stdout.getvalue()[:-1]91 >>> USAGE == temp_stdout.getvalue()[:-1] 90 92 True 91 93 … … 98 100 ... os.path.dirname( 99 101 ... os.path.abspath(__file__)), 100 ... test_path, "xxxxx")102 ... TEST_PATH, "xxxxx") 101 103 >>> sys.argv = ["", _config_path] 102 104 >>> _config_path = config_path() 103 105 >>> sys.stdout = save_stdout 104 >>> usage== temp_stdout.getvalue()[:-1]106 >>> USAGE == temp_stdout.getvalue()[:-1] 105 107 True 106 108 … … 110 112 ... os.path.dirname( 111 113 ... os.path.abspath(__file__)), 112 ... test_path, "config.py")114 ... TEST_PATH, "config.py") 113 115 >>> sys.argv = ["", _config_path] 114 116 >>> _config_path == config_path() … … 132 134 raise IOError("Incorrect number of arguments supplied.") 133 135 except IOError: 134 print usage136 print USAGE 135 137 return path 136 138 … … 145 147 ... os.path.dirname( 146 148 ... os.path.abspath(__file__)), 147 ... test_path, "empty_config.py")149 ... TEST_PATH, "empty_config.py") 148 150 >>> zipdir,xmldir,zipdir_pattern,zipfile_pattern,xmlfile_pattern = \ 149 151 config(_config_path) … … 162 164 ... os.path.dirname( 163 165 ... os.path.abspath(__file__)), 164 ... test_path, "xxxxx")166 ... TEST_PATH, "xxxxx") 165 167 >>> zipdir,xmldir,zipdir_pattern,zipfile_pattern,xmlfile_pattern = \ 166 168 config(_config_path) 167 169 >>> sys.stdout = save_stdout 168 >>> usage== temp_stdout.getvalue()[:-1]170 >>> USAGE == temp_stdout.getvalue()[:-1] 169 171 True 170 172 >>> zipdir … … 182 184 ... os.path.dirname( 183 185 ... os.path.abspath(__file__)), 184 ... test_path, "bad_config.py")186 ... TEST_PATH, "bad_config.py") 185 187 >>> zipdir,xmldir,zipdir_pattern,zipfile_pattern,xmlfile_pattern = \ 186 188 config(_config_path) 187 189 >>> sys.stdout = save_stdout 188 >>> usage== temp_stdout.getvalue()[:-1]190 >>> USAGE == temp_stdout.getvalue()[:-1] 189 191 True 190 192 >>> … … 200 202 ... os.path.dirname( 201 203 ... os.path.abspath(__file__)), 202 ... test_path, "config.py")204 ... TEST_PATH, "config.py") 203 205 >>> zipdir,xmldir,zipdir_pattern,zipfile_pattern,xmlfile_pattern = \ 204 206 config(_config_path) 205 207 >>> zipdir == os.path.join(os.path.dirname(os.path.abspath(__file__)), 206 ... test_path, "zip")208 ... TEST_PATH, "zip") 207 209 True 208 210 >>> xmldir == os.path.join(os.path.dirname(os.path.abspath(__file__)), 209 ... test_path, "xml")211 ... TEST_PATH, "xml") 210 212 True 211 213 >>> zipdir_pattern == "[0-9][0-9][0-9][0-9]_[0-9][0-9]" … … 230 232 execfile(path, globals(), namespace) 231 233 except IOError: 232 print usage234 print USAGE 233 235 except SyntaxError: 234 print usage236 print USAGE 235 237 return (namespace["zipdir"], 236 238 namespace["xmldir"], … … 249 251 ... os.path.dirname( 250 252 ... os.path.abspath(__file__)), 251 ... test_path, "xmlref")253 ... TEST_PATH, "xmlref") 252 254 >>> xmlref = glob.glob(os.path.join(xmlref_path, "*")) 253 255 >>> xmlref_path = [path for path in xmlref if os.path.isdir(path)][0] … … 255 257 ... os.path.dirname( 256 258 ... os.path.abspath(__file__)), 257 ... test_path, "xmltest")259 ... TEST_PATH, "xmltest") 258 260 >>> if os.path.exists(xmltest_path): 259 261 ... shutil.rmtree(xmltest_path) … … 313 315 ... os.path.dirname( 314 316 ... os.path.abspath(__file__)), 315 ... test_path, "config.py")317 ... TEST_PATH, "config.py") 316 318 >>> zipdir,xmldir,zipdir_pattern,zipfile_pattern,xmlfile_pattern = \ 317 319 config(_config_path) … … 322 324 ... os.path.dirname( 323 325 ... os.path.abspath(__file__)), 324 ... test_path, "xmlref")325 >>> ref_paths = sorted(glob.glob(os.path.join( test_path, "xmlref",326 ... TEST_PATH, "xmlref") 327 >>> ref_paths = sorted(glob.glob(os.path.join(TEST_PATH, "xmlref", 326 328 ... "*", "*.ref"))) 327 329 >>> xml_paths = sorted(glob.glob(os.path.join(xmldir, "*", "*.xml"))) spongenet/trunk/spongenet/tests/expand/bad_config.py
r337 r344 1 #!/usr/bin/env python 2 1 3 """Bad test configuration for the expand module.""" 2 4 spongenet/trunk/spongenet/tests/expand/config.py
r337 r344 1 #!/usr/bin/env python 2 1 3 """Valid test configuration for the expand module.""" 2 4 spongenet/trunk/spongenet/tests/expand/empty_config.py
r337 r344 1 #!/usr/bin/env python 2 1 3 """Empty test configuration for the expand module."""