mailRe: unit tests vs... the current test_suite


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by Gary S. Thompson on October 30, 2006 - 18:16:
Just as a not io have (just) started to write unit tests for the float.py module:

test_float.py:

#!/usr/bin/python

import unittest
from float  import *
FLOAT_EPSILON=float(4.94065645841247e-324) # replace a a later date

class testfloat(unittest.TestCase):
def testGetFloatClass(self):
tests = ( CLASS_POS_INF, pos_inf,
CLASS_NEG_INF, neg_inf,
CLASS_POS_NORMAL, float(1e6),
CLASS_NEG_NORMAL, -float(1e6),
CLASS_POS_DENORMAL, FLOAT_EPSILON,
CLASS_NEG_DENORMAL, -FLOAT_EPSILON,
CLASS_QUIET_NAN, nan,
# WE DON'T USE SIGNAL NANS CLASS_SIGNAL_NAN,
CLASS_POS_ZERO, float(0),
CLASS_NEG_ZERO, -float(0))
for (fpClass, value) in tests:
self.assertEqual(fpClass, getFloatClass(value))
if __name__ == '__main__':
unittest.main()


It doesn't work yet but is a start. Should I alter the relax test suite to run it as one of the tests... (I would add a directory seracher... that would create hierachies of test suites...)

regards gary

--
-------------------------------------------------------------------
Dr Gary Thompson
Astbury Centre for Structural Molecular Biology,
University of Leeds, Astbury Building,
Leeds, LS2 9JT, West-Yorkshire, UK             Tel. +44-113-3433024
email: garyt@xxxxxxxxxxxxxxx                   Fax  +44-113-2331407
-------------------------------------------------------------------





Related Messages


Powered by MHonArc, Updated Mon Oct 30 18:41:39 2006