def test_get_undefined_variable(self): """ Test that get None for an undefined variable. """ interp = Interpreter() self.assertEqual(interp.get('x'), None)
def test_string_starting_with_number_set(self): """ Not keen on this aspect of Tcl """ interp = Interpreter() interp.eval('set x 123.4234excel') self.assertEqual(interp.get('x'), '123.4234excel')
def test_simple_set_read(self): interp = Interpreter() interp.eval('set x "5"') result = interp.eval('set x') self.assertEqual(result.value, '5') self.assertEqual(interp.get('x'), '5')
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)
def test_float_with_exponent_set(self): interp = Interpreter() interp.eval('set x 12.34e-14') self.assertEqual(interp.get('x'), 1.234e-13)
def test_float_set(self): interp = Interpreter() interp.eval('set x 12.34') self.assertEqual(interp.get('x'), 12.34)
def test_string_set_single_quote(self): interp = Interpreter() interp.eval('set x \'This is a string\'') self.assertEqual(interp.get('x'), 'This is a string')
def test_simple_set_script_string_single_quote(self): interp = Interpreter() interp.eval('set x \'5\'') self.assertEqual(interp.get('x'), '5')
def test_string_set(self): interp = Interpreter() interp.eval('set x "This is a string"') self.assertEqual(interp.get('x'), 'This is a string')
def test_simple_set_script_string(self): interp = Interpreter() interp.eval('set x "5"') self.assertEqual(interp.get('x'), '5')
def test_simple_set_script_integer(self): interp = Interpreter() interp.eval('set x 5') self.assertEqual(interp.get('x'), 5)
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')