Пример #1
0
 def test_should_be_able_to_set_method_on_self(self):
     script = Script(
         'def my_print(str):\n' \
         '    return str\n\n' \
         'self.my_print = my_print')
     script.execute()
     assert script.my_print
     assert script.my_print('test') == 'test'
Пример #2
0
 def test_should_execute_code(self):
     script = Script(
         'test_variable = "I am testing!"\n' \
         'assert test_variable == "I am testing!"')
     assert script.execute()