self.y = Symbol('y')
def test_new(self):
- self.assertEqual(Symbol(' x '), self.x)
+ self.assertEqual(Symbol('x'), self.x)
with self.assertRaises(TypeError):
Symbol(self.x)
with self.assertRaises(TypeError):
Symbol(1)
+ with self.assertRaises(SyntaxError):
+ Symbol('1')
+ with self.assertRaises(SyntaxError):
+ Symbol('x.1')
+ with self.assertRaises(SyntaxError):
+ Symbol('x 1')
+ Symbol('_')
+ Symbol('_x')
+ Symbol('x_1')
def test_name(self):
self.assertEqual(self.x.name, 'x')