Example #1
0
 def __init__(self, op, *args):
     """Op is a string or number; args are Exprs (or are coerced to Exprs)."""
     assert (isinstance(op, str) or isinstance(op, Description)
             or (utils.is_number(op) and not args))
     if isinstance(op, Description):
         self.op = op
     else:
         self.op = utils.num_or_str(op)
     self.args = map(expr, args)  # Coerce args to Exprs
Example #2
0
 def __init__(self, op, *args):
   """Op is a string or number; args are Exprs (or are coerced to Exprs)."""
   assert (isinstance(op, str) or
           isinstance(op, Description) or
           (utils.is_number(op) and not args))
   if isinstance(op, Description):
     self.op = op
   else:
     self.op = utils.num_or_str(op)
   self.args = map(expr, args)  # Coerce args to Exprs
Example #3
0
 def test_num_or_str(self):
   """Test num_or_str."""
   self.assertEqual(42, utils.num_or_str('42'))
   self.assertEqual('42x', utils.num_or_str('42x'))
Example #4
0
 def test_num_or_str(self):
     """Test num_or_str."""
     self.assertEqual(42, utils.num_or_str('42'))
     self.assertEqual('42x', utils.num_or_str('42x'))