Esempio n. 1
0
    def test_cannot_set_variable_to_class(self):
        interp = Interpreter()

        with self.assertRaises(Exception) as context:
            interp.set('x', interp)

        self.assertTrue(
            "Cannot set a variable to type <class 'pytcl.interp.Interpreter'>"
            in str(context.exception))
Esempio n. 2
0
    def test_set_and_get_variable(self):
        """
        Test that we can set and get a variable.
        """
        interp = Interpreter()

        interp.set('x', 5)

        self.assertEqual(interp.get('x'), 5)
Esempio n. 3
0
    def test_simple_set_string_script_2(self):
        interp = Interpreter()

        interp.set('x', "The quick brown fox")

        self.assertEqual(interp.get('x'), 'The quick brown fox')