Exemplo n.º 1
0
 def assign_str(self, lhs, rhs):
     rhs = Expression.expand_integer_powers(rhs)
     nmodl_str = ccode(rhs, user_functions=Expression._cfunc_map,
                       assign_to=lhs)
     nmodl_str = Expression.strip_L_from_rationals(nmodl_str)
     nmodl_str = nmodl_str.replace(';', '')
     return nmodl_str
Exemplo n.º 2
0
 def test_rationals_match(self):
     self.assertEqual(Expression.strip_L_from_rationals('aL/bL'), 'aL/bL')
     self.assertEqual(Expression.strip_L_from_rationals('a0L/bL'), 'a0L/bL')
     self.assertEqual(Expression.strip_L_from_rationals('aL/b0L'), 'aL/b0L')
     self.assertEqual(Expression.strip_L_from_rationals('a0L/b0L'),
                      'a0L/b0L')
     self.assertEqual(Expression.strip_L_from_rationals('aL/b0L'), 'aL/b0L')
     self.assertEqual(Expression.strip_L_from_rationals('1/2'), '1/2')
     self.assertEqual(Expression.strip_L_from_rationals('1L/2L'), '1/2')
     self.assertEqual(Expression.strip_L_from_rationals('1.0L/2.0L'),
                      '1.0/2.0')
Exemplo n.º 3
0
 def test_rationals_match(self):
     self.assertEqual(Expression.strip_L_from_rationals('aL/bL'), 'aL/bL')
     self.assertEqual(Expression.strip_L_from_rationals('a0L/bL'), 'a0L/bL')
     self.assertEqual(Expression.strip_L_from_rationals('aL/b0L'), 'aL/b0L')
     self.assertEqual(Expression.strip_L_from_rationals('a0L/b0L'),
                      'a0L/b0L')
     self.assertEqual(Expression.strip_L_from_rationals('aL/b0L'), 'aL/b0L')
     self.assertEqual(Expression.strip_L_from_rationals('1/2'), '1/2')
     self.assertEqual(Expression.strip_L_from_rationals('1L/2L'), '1/2')
     self.assertEqual(Expression.strip_L_from_rationals('1.0L/2.0L'),
                      '1.0/2.0')