Revision: 632 http://rpy.svn.sourceforge.net/rpy/?rev=632&view=rev Author: lgautier Date: 2008-08-17 10:56:14 +0000 (Sun, 17 Aug 2008)
Log Message: ----------- - Fixed buggy constructors in SexpVector wrappers - Added unit tests to assert bug fixes Modified Paths: -------------- branches/rpy_nextgen/rpy/rinterface/__init__.py branches/rpy_nextgen/rpy/rinterface/tests/test_SexpVector.py Modified: branches/rpy_nextgen/rpy/rinterface/__init__.py =================================================================== --- branches/rpy_nextgen/rpy/rinterface/__init__.py 2008-08-17 10:38:46 UTC (rev 631) +++ branches/rpy_nextgen/rpy/rinterface/__init__.py 2008-08-17 10:56:14 UTC (rev 632) @@ -48,7 +48,7 @@ Vector of integers. """ def __init__(self, v): - super(StrSexpVector, self).__init__(v, INTSXP) + super(IntSexpVector, self).__init__(v, INTSXP) class FloatSexpVector(SexpVector): @@ -56,7 +56,7 @@ Vector of floats. """ def __init__(self, v): - super(StrSexpVector, self).__init__(v, REALSXP) + super(FloatSexpVector, self).__init__(v, REALSXP) # wrapper because print is strangely not a function Modified: branches/rpy_nextgen/rpy/rinterface/tests/test_SexpVector.py =================================================================== --- branches/rpy_nextgen/rpy/rinterface/tests/test_SexpVector.py 2008-08-17 10:38:46 UTC (rev 631) +++ branches/rpy_nextgen/rpy/rinterface/tests/test_SexpVector.py 2008-08-17 10:56:14 UTC (rev 632) @@ -7,6 +7,26 @@ def floatEqual(x, y, epsilon = 0.00000001): return abs(x - y) < epsilon + +class WrapperSexpVectorTestCase(unittest.TestCase): + def testInt(self): + sexp = ri.IntSexpVector([1, ]) + isInteger = ri.globalEnv.get("is.integer") + ok = isInteger(sexp)[0] + self.assertTrue(ok) + + def testFloat(self): + sexp = ri.IntSexpVector([1.0, ]) + isNumeric = ri.globalEnv.get("is.numeric") + ok = isNumeric(sexp)[0] + self.assertTrue(ok) + + def testStr(self): + sexp = ri.StrSexpVector(["a", ]) + isStr = ri.globalEnv.get("is.character") + ok = isStr(sexp)[0] + self.assertTrue(ok) + class SexpVectorTestCase(unittest.TestCase): #def setUpt(self): # ri.initEmbeddedR("foo", "--no-save") @@ -227,6 +247,7 @@ def suite(): suite = unittest.TestLoader().loadTestsFromTestCase(SexpVectorTestCase) + suite.addTest(unittest.TestLoader().loadTestsFromTestCase(WrapperSexpVectorTestCase)) return suite if __name__ == '__main__': This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ rpy-list mailing list rpy-list@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/rpy-list