OLD | NEW |
1 # $Id: test_expr.py 1527 2006-05-07 16:41:16Z mu $ | |
2 from tests import TestCase, add | 1 from tests import TestCase, add |
3 from yasm import Expression | 2 from yasm import Expression |
4 import operator | 3 import operator |
5 | 4 |
6 class TExpression(TestCase): | 5 class TExpression(TestCase): |
7 def test_create(self): | 6 def test_create(self): |
8 e1 = Expression(operator.add, 1, 2) | 7 e1 = Expression(operator.add, 1, 2) |
9 e2 = Expression('+', 1, 2) | 8 e2 = Expression('+', 1, 2) |
10 | 9 |
11 self.assertEquals(e1.get_intnum(), e1.get_intnum()) | 10 self.assertEquals(e1.get_intnum(), e1.get_intnum()) |
12 | 11 |
13 def test_extract(self): | 12 def test_extract(self): |
14 e1 = Expression('/', 15, 5) | 13 e1 = Expression('/', 15, 5) |
15 self.assertEquals(e1.get_intnum(), 3) | 14 self.assertEquals(e1.get_intnum(), 3) |
16 self.assertRaises(ValueError, e1.extract_segoff) | 15 self.assertRaises(ValueError, e1.extract_segoff) |
17 self.assertRaises(ValueError, e1.extract_wrt) | 16 self.assertRaises(ValueError, e1.extract_wrt) |
18 | 17 |
19 add(TExpression) | 18 add(TExpression) |
OLD | NEW |