Re: rewrote tests in unittest/ to python unittests
joerg <j.beyer-S0/[email protected]>
| Newsgroups | gmane.comp.tools.aap.devel |
|---|---|
| Message-ID | <[email protected]> |
Joerg Beyer wrote:
> Dear List Reader,
>
> on popular request (by a single guy) I rewrote the tests in
> the a-a-p directory Exec/unittest to be regular python
> unittests. One advantage is, that the tests wont stop (sys.exit())
> if a single tests fail.
here is another test, just put in in the check.py, somewhere
at the end, over that line: "if __name__ == "__main__":
Joerg
class RecPythonTestCase(unittest.TestCase):
def testSufreplace(self):
from RecPython import sufreplace
# this calls should work
for suffrom, sufto, var, expected in [
("x", "y", "huhu.x", "huhu.y"),
(".cpp", ".o", "huhu.cpp", "huhu.o"),
(".c", ".o", "huhu.c", "huhu.o"),
(".123456789", ".Z", "huhu.123456789", "huhu.Z"),
("X", "Y", "huhuX", "huhuY"),
]:
result = sufreplace(suffrom, sufto, var)
self.failUnlessEqual(result, expected,
msg = "sufreplace('%s', '%s', '%s') = '%s' != '%s'" % (suffrom,
sufto, var, result, expected))
# this calls should raise
for suffrom, sufto, var in [ ("x", "y", "huhu"), (".cpp", ".o",
"source.c")]:
self.assertRaises(StandardError, sufreplace, suffrom,
sufto, var,
msg = "sufreplace('%s', '%s', '%s') should have raised, but
has not" % (suffrom,
sufto, var ))
-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01