コード例 #1
0
 def test_atomic_literals(self):
     assert constraintgen.constraints_expr(self.parse_expr('"hello"')).type == NamedType('str')
     assert constraintgen.constraints_expr(self.parse_expr('u"hello"')).type == NamedType('str')
     assert constraintgen.constraints_expr(self.parse_expr('3')).type == NamedType('int')
     assert constraintgen.constraints_expr(self.parse_expr('3L')).type == NamedType('long')
     assert constraintgen.constraints_expr(self.parse_expr('-2.5')).type == NamedType('float')
     assert constraintgen.constraints_expr(self.parse_expr('7.40J')).type == NamedType('complex')
コード例 #2
0
 def test_list_literals(self):
     for expr in ['[]', '[3]', '["hello"]', '[[]]' ]:
         assert isinstance(constraintgen.constraints_expr(self.parse_expr(expr)).type, List)