def test_exception(self): expr = Expression('+', 1, 2) self.symtab.define_equ("foo", expr, 0) self.assertRaises(YasmError, self.symtab.define_equ, "foo", expr, 0) self.symtab.define_equ("bar", expr, 0) # cleared self.assertRaises(YasmError, self.symtab.define_special, "bar", 'global')
def test_create(self): e1 = Expression(operator.add, 1, 2) e2 = Expression('+', 1, 2) self.assertEquals(e1.get_intnum(), e1.get_intnum())
def test_extract(self): e1 = Expression('/', 15, 5) self.assertEquals(e1.get_intnum(), 3) self.assertRaises(ValueError, e1.extract_segoff) self.assertRaises(ValueError, e1.extract_wrt)