Revision: 668 http://rpy.svn.sourceforge.net/rpy/?rev=668&view=rev Author: lgautier Date: 2008-10-29 20:39:25 +0000 (Wed, 29 Oct 2008)
Log Message: ----------- doc: - still editing rpy_classic: - added long-missing tests (although coverage is quite low) rinterface: - fixed docstring robjects: - added docstrings Modified Paths: -------------- branches/rpy_nextgen/NEWS branches/rpy_nextgen/doc/source/robjects.rst branches/rpy_nextgen/rpy/rinterface/__init__.py branches/rpy_nextgen/rpy/robjects/__init__.py branches/rpy_nextgen/rpy/tests.py Added Paths: ----------- branches/rpy_nextgen/rpy/tests_rpy_classic.py Modified: branches/rpy_nextgen/NEWS =================================================================== --- branches/rpy_nextgen/NEWS 2008-10-29 09:38:54 UTC (rev 667) +++ branches/rpy_nextgen/NEWS 2008-10-29 20:39:25 UTC (rev 668) @@ -1,13 +1,7 @@ SVN === -Changes -------- -:mod:`rpy2.robjects`: - -- Constructor for :class:`rpy2.robjects.RDataFrame` checks that R lists are data.frames (not all lists are data.frame) - New features ------------ @@ -29,6 +23,9 @@ - does not alias :class:`rinterface.StrSexpVector`, :class:`rinterface.IntSexpVector`, :class:`rinterface.FloatSexpVector` anymore +- Constructor for :class:`rpy2.robjects.RDataFrame` checks that R lists are data.frames (not all lists are data.frame) + + Bugs fixed ---------- @@ -37,6 +34,7 @@ - __pow__ was missing from the delegator object for robjects.RVector (while the documentation was claiming it was there) # bug report by Robert Nuske - Earlier change from Sexp.typeof() to getter Sexp.typeof was not reflected in :mod:`rpy2.rpy_classic` # bug report by Robert Denham + Release 2.0.0b1 =============== Modified: branches/rpy_nextgen/doc/source/robjects.rst =================================================================== --- branches/rpy_nextgen/doc/source/robjects.rst 2008-10-29 09:38:54 UTC (rev 667) +++ branches/rpy_nextgen/doc/source/robjects.rst 2008-10-29 20:39:25 UTC (rev 668) @@ -274,7 +274,7 @@ .. note:: The boolean operator ``not`` cannot be redefined in Python (at least up to - version 2.5), and its behavior could be made to mimic R's behavior + version 2.5), and its behavior could not be made to mimic R's behavior .. index:: single: names; robjects Modified: branches/rpy_nextgen/rpy/rinterface/__init__.py =================================================================== --- branches/rpy_nextgen/rpy/rinterface/__init__.py 2008-10-29 09:38:54 UTC (rev 667) +++ branches/rpy_nextgen/rpy/rinterface/__init__.py 2008-10-29 20:39:25 UTC (rev 668) @@ -60,7 +60,7 @@ class BoolSexpVector(SexpVector): """ - Vector of floats. + Vector of booleans (logical in R terminology). """ def __init__(self, v): super(BoolSexpVector, self).__init__(v, LGLSXP) Modified: branches/rpy_nextgen/rpy/robjects/__init__.py =================================================================== --- branches/rpy_nextgen/rpy/robjects/__init__.py 2008-10-29 09:38:54 UTC (rev 667) +++ branches/rpy_nextgen/rpy/robjects/__init__.py 2008-10-29 20:39:25 UTC (rev 668) @@ -274,21 +274,25 @@ return res class StrVector(RVector): + """ Vector of string elements """ def __init__(self, obj): obj = rinterface.StrSexpVector(obj) super(StrVector, self).__init__(obj) class IntVector(RVector): + """ Vector of integer elements """ def __init__(self, obj): obj = rinterface.IntSexpVector(obj) super(IntVector, self).__init__(obj) class BoolVector(RVector): + """ Vector of boolean (logical) elements """ def __init__(self, obj): obj = rinterface.BoolSexpVector(obj) super(BoolVector, self).__init__(obj) class FloatVector(RVector): + """ Vector of float (double) elements """ def __init__(self, obj): obj = rinterface.FloatSexpVector(obj) super(FloatVector, self).__init__(obj) Modified: branches/rpy_nextgen/rpy/tests.py =================================================================== --- branches/rpy_nextgen/rpy/tests.py 2008-10-29 09:38:54 UTC (rev 667) +++ branches/rpy_nextgen/rpy/tests.py 2008-10-29 20:39:25 UTC (rev 668) @@ -4,13 +4,20 @@ import rpy2.rinterface.tests import rpy2.rlike.tests +import rpy2.tests_rpy_classic + def suite(): suite_robjects = rpy2.robjects.tests.suite() suite_rinterface = rpy2.rinterface.tests.suite() suite_rlike = rpy2.rlike.tests.suite() + + suite_rpy_classic = rpy2.tests_rpy_classic.suite() + alltests = unittest.TestSuite([suite_robjects, suite_rinterface, - suite_rlike]) + suite_rlike, + suite_rpy_classic + ]) return alltests if __name__ == "__main__": Added: branches/rpy_nextgen/rpy/tests_rpy_classic.py =================================================================== --- branches/rpy_nextgen/rpy/tests_rpy_classic.py (rev 0) +++ branches/rpy_nextgen/rpy/tests_rpy_classic.py 2008-10-29 20:39:25 UTC (rev 668) @@ -0,0 +1,35 @@ +import unittest + +import rpy2.rpy_classic as rpy + + +class RpyClassicTestCase(unittest.TestCase): + + def testAttributeExpansion(self): + rpy.set_default_mode(rpy.BASIC_CONVERSION) + wtest = rpy.r.wilcox_test + self.assertTrue(isinstance(wtest, rpy.Robj)) + + def testFunctionCall(self): + rpy.set_default_mode(rpy.BASIC_CONVERSION) + # positional only + three = rpy.r.sum(1,2) + three = three[0] # is this what is happening w/ rpy, or the list is + # ...automatically dropped ? + self.assertEquals(3, three) + # positional + keywords + onetwothree = rpy.r.seq(1, 3, by=0.5) + self.assertEquals([1.0, 1.5, 2.0, 2.5, 3.0], onetwothree) + + def testCallable(self): + rpy.set_default_mode(rpy.NO_CONVERSION) + #in rpy-1.x, everything is callable + self.assertTrue(callable(rpy.r.seq)) + self.assertTrue(callable(rpy.r.pi)) + +def suite(): + suite = unittest.TestLoader().loadTestsFromTestCase(RpyClassicTestCase) + return suite + +if __name__ == '__main__': + unittest.main() Property changes on: branches/rpy_nextgen/rpy/tests_rpy_classic.py ___________________________________________________________________ Added: svn:eol-style + native 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