当前位置: 首页>>代码示例>>Python>>正文


Python addressing.AddressParser类代码示例

本文整理汇总了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))    
开发者ID:dabeaz,项目名称:py65,代码行数:7,代码来源:test_addressing.py

示例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])
开发者ID:BigEd,项目名称:py65,代码行数:7,代码来源:test_addressing.py

示例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])
开发者ID:andybest,项目名称:py65,代码行数:7,代码来源:test_addressing.py

示例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])
开发者ID:B-Rich,项目名称:py65,代码行数:7,代码来源:test_addressing.py

示例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'))
开发者ID:ddribin,项目名称:py65,代码行数:7,代码来源:test_addressing.py

示例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'))
开发者ID:dabeaz,项目名称:py65,代码行数:7,代码来源:test_addressing.py

示例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"))
开发者ID:BigEd,项目名称:py65,代码行数:7,代码来源:test_addressing.py

示例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])
开发者ID:B-Rich,项目名称:py65,代码行数:8,代码来源:test_addressing.py

示例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'))    
开发者ID:dabeaz,项目名称:py65,代码行数:13,代码来源:test_addressing.py

示例10: test_number_bin_literal

 def test_number_bin_literal(self):
   parser = AddressParser()
   self.assertEqual(129, parser.number('%10000001'))
开发者ID:dabeaz,项目名称:py65,代码行数:3,代码来源:test_addressing.py

示例11: test_number_dec_literal

 def test_number_dec_literal(self):
   parser = AddressParser()
   self.assertEqual(49152, parser.number('+49152'))
开发者ID:dabeaz,项目名称:py65,代码行数:3,代码来源:test_addressing.py

示例12: test_number_hex_literal

 def test_number_hex_literal(self):
   parser = AddressParser()
   self.assertEqual(49152, parser.number('$c000'))
开发者ID:dabeaz,项目名称:py65,代码行数:3,代码来源:test_addressing.py

示例13: test_maxwidth_setter

 def test_maxwidth_setter(self):
   parser = AddressParser()
   parser.maxwidth = 24
   self.assertEqual(24, parser.maxwidth)
   self.assertEqual(0xFFFFFF, parser._maxaddr)       
开发者ID:dabeaz,项目名称:py65,代码行数:5,代码来源:test_addressing.py

示例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'))
开发者ID:dabeaz,项目名称:py65,代码行数:3,代码来源:test_addressing.py

示例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')
开发者ID:B-Rich,项目名称:py65,代码行数:5,代码来源:test_addressing.py


注:本文中的py65.utils.addressing.AddressParser类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。