Ejemplo n.º 1
0
 def test_exceptions(self):
     from pypy import program
     with self.assertRaises(TypeError):
         program.square({})
     from pypy import operator
     with self.assertRaises(ZeroDivisionError):
         operator.div(5, 0)
     with self.assertRaises(AttributeError):
         operator.not_an_actual_function(5, 0)
Ejemplo n.º 2
0
    def test_multiple_imports(self):
        from pypy import adder, program
        self.assertEquals(1, adder.inc())
        self.assertEquals(4, program.square(2))
        self.assertEquals(2, adder.inc())
        self.assertEquals(8, program.add(6, 2))

        from pypy import adder
        from pypy import program
        self.assertEquals(3, adder.inc())
        self.assertEquals(36, program.product(6, 2, 3))
Ejemplo n.º 3
0
 def test_import(self):
     from pypy import program
     self.assertEquals(4, program.square(2))
     self.assertEquals(8, program.add(6, 2))
     self.assertEquals(36, program.product(6, 2, 3))