/usr/lib/python2.7/dist-packages/rpy2/robjects/tests/testFormula.py is in python-rpy2 2.4.4-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | import unittest
import rpy2.robjects as robjects
rinterface = robjects.rinterface
class FormulaTestCase(unittest.TestCase):
def testNew(self):
fml = robjects.Formula("y ~ x")
self.assertEqual("formula", fml.rclass[0])
def testGetenvironment(self):
fml = robjects.Formula("y ~ x")
env = fml.getenvironment()
self.assertEqual("environment", env.rclass[0])
def testSetenvironment(self):
fml = robjects.Formula("y ~ x")
newenv = robjects.baseenv['new.env']()
env = fml.getenvironment()
self.assertFalse(newenv.rsame(env))
fml.setenvironment(newenv)
env = fml.getenvironment()
self.assertTrue(newenv.rsame(env))
def suite():
suite = unittest.TestLoader().loadTestsFromTestCase(FormulaTestCase)
return suite
if __name__ == '__main__':
unittest.main()
|