本文整理汇总了Python中py65.utils.addressing.AddressParser.labels方法的典型用法代码示例。如果您正苦于以下问题:Python AddressParser.labels方法的具体用法?Python AddressParser.labels怎么用?Python AddressParser.labels使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类py65.utils.addressing.AddressParser
的用法示例。
在下文中一共展示了AddressParser.labels方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_number_label_dec_offset
# 需要导入模块: from py65.utils.addressing import AddressParser [as 别名]
# 或者: from py65.utils.addressing.AddressParser import labels [as 别名]
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'))
示例2: test_number_label_bin_offset
# 需要导入模块: from py65.utils.addressing import AddressParser [as 别名]
# 或者: from py65.utils.addressing.AddressParser import labels [as 别名]
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'))
示例3: test_number_label_dec_offset
# 需要导入模块: from py65.utils.addressing import AddressParser [as 别名]
# 或者: from py65.utils.addressing.AddressParser import labels [as 别名]
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"))
示例4: test_number_bad_label_syntax
# 需要导入模块: from py65.utils.addressing import AddressParser [as 别名]
# 或者: from py65.utils.addressing.AddressParser import labels [as 别名]
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])
示例5: test_number_label_offset_default_radix
# 需要导入模块: from py65.utils.addressing import AddressParser [as 别名]
# 或者: from py65.utils.addressing.AddressParser import labels [as 别名]
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'))
示例6: test_number_truncates_address_at_maxwidth_16
# 需要导入模块: from py65.utils.addressing import AddressParser [as 别名]
# 或者: from py65.utils.addressing.AddressParser import labels [as 别名]
def test_number_truncates_address_at_maxwidth_16(self):
parser = AddressParser()
parser.labels = {'foo': 0xFFFF}
self.assertEqual(0xFFFF, parser.number('foo+5'))
示例7: test_number_label
# 需要导入模块: from py65.utils.addressing import AddressParser [as 别名]
# 或者: from py65.utils.addressing.AddressParser import labels [as 别名]
def test_number_label(self):
parser = AddressParser()
parser.labels = {'foo': 0xC000}
self.assertEqual(0xC000, parser.number('foo'))
示例8: test_number_constrains_address_at_maxwidth_24
# 需要导入模块: from py65.utils.addressing import AddressParser [as 别名]
# 或者: from py65.utils.addressing.AddressParser import labels [as 别名]
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')
示例9: test_number_truncates_address_at_maxwidth_24
# 需要导入模块: from py65.utils.addressing import AddressParser [as 别名]
# 或者: from py65.utils.addressing.AddressParser import labels [as 别名]
def test_number_truncates_address_at_maxwidth_24(self):
parser = AddressParser()
parser.maxwidth = 24
parser.labels = {"foo": 0xFFFFFF}
self.assertEqual(0xFFFFFF, parser.number("foo+5"))