예제 #1
0
        def f(_):
            class A():
                def __init__(selfArg, x):
                    if x > 0:
                        selfArg.x = x
                    else:
                        selfArg.x = (-1) * x

            return A(1).x + A(-1).x
예제 #2
0
        def f(arg):
            class A():
                def __init__(selfArg):
                    selfArg.x = 2
                    selfArg.x = selfArg.x + 1

            return A().x + arg
예제 #3
0
        def f(arg):
            class A():
                def __init__(self, x):
                    self.x = x
                    self.y = self.x + 1

            return A(arg).x
예제 #4
0
        def f(arg):
            class A():
                def __init__(self, x):
                    self_x = arg
                    self.x = x + self_x

            return A(2).x
예제 #5
0
    def test_class_line_number_collision(self):
        from ufora.FORA.python.PurePython.testModules.same_line_number.A import A
        from ufora.FORA.python.PurePython.testModules.same_line_number.A import B

        line_number_of_class_A_definition = PyforaInspect.getsourcelines(A)[1]
        line_number_of_class_B_definition = PyforaInspect.getsourcelines(B)[1]

        self.assertEqual(line_number_of_class_A_definition,
                         line_number_of_class_B_definition)

        with self.create_executor() as executor:
            x = 99999

            with executor.remotely.downloadAll():
                a = A(99999)

            self.assertIsInstance(a, A)
            self.assertEqual(a.__dict__, A(x).__dict__)
예제 #6
0
        def f(arg):
            class A():
                def __init__(self, x):
                    self.x = x
                    self.x = self.x + 1

                def foo(self, y):
                    return self.x + y

            return A(arg).foo(2)
예제 #7
0
        def f():
            class A():
                def __init__(self, x):
                    (self.x, self.y) = (x, x + 1)

            return A(2).x
예제 #8
0
        def f(arg):
            class A():
                def __init__(self, x):
                    self.x = x + arg

            return A(2).x