本文整理汇总了Python中py65.utils.addressing.AddressParser类的典型用法代码示例。如果您正苦于以下问题:Python AddressParser类的具体用法?Python AddressParser怎么用?Python AddressParser使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了AddressParser类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_number_bad_label_with_offset
def test_number_bad_label_with_offset(self):
parser = AddressParser()
try:
parser.number('bad_label+3')
self.fail()
except KeyError as why:
self.assertEqual("'Label not found: bad_label'", str(why))
示例2: test_number_bad_label_with_offset
def test_number_bad_label_with_offset(self):
parser = AddressParser()
try:
parser.number("bad_label+3")
self.fail()
except KeyError, why:
self.assertEqual("Label not found: bad_label", why[0])
示例3: test_number_bad_label
def test_number_bad_label(self):
parser = AddressParser()
try:
parser.number('bad_label')
self.fail()
except KeyError, why:
self.assertEqual('Label not found: bad_label', why[0])
示例4: test_number_bad_label_with_offset
def test_number_bad_label_with_offset(self):
parser = AddressParser()
try:
parser.number('bad_label+3')
self.fail()
except KeyError as exc:
self.assertEqual('Label not found: bad_label', exc.args[0])
示例5: test_number_label_dec_offset
def test_number_label_dec_offset(self):
parser = AddressParser()
parser.labels = {'foo': 0xC000}
self.assertEquals(0xC003, parser.number('foo++3'))
self.assertEquals(0xBFFD, parser.number('foo-+3'))
self.assertEquals(0xC003, parser.number('foo + +3'))
self.assertEquals(0xBFFD, parser.number('foo - +3'))
示例6: test_number_label_bin_offset
def test_number_label_bin_offset(self):
parser = AddressParser()
parser.labels = {'foo': 0xC000}
self.assertEqual(0xC003, parser.number('foo+%00000011'))
self.assertEqual(0xBFFD, parser.number('foo-%00000011'))
self.assertEqual(0xC003, parser.number('foo + %00000011'))
self.assertEqual(0xBFFD, parser.number('foo - %00000011'))
示例7: test_number_label_dec_offset
def test_number_label_dec_offset(self):
parser = AddressParser()
parser.labels = {"foo": 0xC000}
self.assertEqual(0xC003, parser.number("foo++3"))
self.assertEqual(0xBFFD, parser.number("foo-+3"))
self.assertEqual(0xC003, parser.number("foo + +3"))
self.assertEqual(0xBFFD, parser.number("foo - +3"))
示例8: test_number_bad_label_syntax
def test_number_bad_label_syntax(self):
parser = AddressParser()
parser.labels = {'foo': 0xFFFF}
try:
parser.number('#$foo')
self.fail()
except KeyError as exc:
self.assertEqual('Label not found: #$foo', exc.args[0])
示例9: test_number_label_offset_default_radix
def test_number_label_offset_default_radix(self):
parser = AddressParser()
parser.labels = {'foo': 0xC000}
parser.radix = 16
self.assertEqual(0xC010, parser.number('foo+10'))
self.assertEqual(0xBFF0, parser.number('foo-10'))
self.assertEqual(0xC010, parser.number('foo + 10'))
self.assertEqual(0xBFF0, parser.number('foo - 10'))
parser.radix = 10
self.assertEqual(0xC00A, parser.number('foo+10'))
self.assertEqual(0xBFF6, parser.number('foo-10'))
self.assertEqual(0xC00A, parser.number('foo + 10'))
self.assertEqual(0xBFF6, parser.number('foo - 10'))
示例10: test_number_bin_literal
def test_number_bin_literal(self):
parser = AddressParser()
self.assertEqual(129, parser.number('%10000001'))
示例11: test_number_dec_literal
def test_number_dec_literal(self):
parser = AddressParser()
self.assertEqual(49152, parser.number('+49152'))
示例12: test_number_hex_literal
def test_number_hex_literal(self):
parser = AddressParser()
self.assertEqual(49152, parser.number('$c000'))
示例13: test_maxwidth_setter
def test_maxwidth_setter(self):
parser = AddressParser()
parser.maxwidth = 24
self.assertEqual(24, parser.maxwidth)
self.assertEqual(0xFFFFFF, parser._maxaddr)
示例14: test_label_for_returns_alternate_default
def test_label_for_returns_alternate_default(self):
parser = AddressParser(labels={})
self.assertEqual('foo', parser.label_for(0xFFD2, 'foo'))
示例15: test_number_constrains_address_at_maxwidth_24
def test_number_constrains_address_at_maxwidth_24(self):
parser = AddressParser()
parser.maxwidth = 24
parser.labels = {'foo': 0xFFFFFF}
self.assertRaises(OverflowError, parser.number, 'foo+5')