1
0
mirror of https://github.com/mnaberez/py65.git synced 2024-11-19 06:31:08 +00:00

Added tests for AddressParser.label_for().

This commit is contained in:
Mike Naberezny 2009-03-23 21:50:54 -07:00
parent 6bcfe9233f
commit d43cda43b5

View File

@ -90,7 +90,18 @@ class AddressParserTests(unittest.TestCase):
self.fail()
except KeyError, why:
self.assertEqual('Label not found: bad_label', why[0])
def test_label_for_returns_label(self):
parser = util.AddressParser(labels={'chrout':0xFFD2})
self.assertEqual('chrout', parser.label_for(0xFFD2))
def test_label_for_returns_none_by_default(self):
parser = util.AddressParser(labels={})
self.assertEqual(None, parser.label_for(0xFFD2))
def test_label_for_returns_alternate_default(self):
parser = util.AddressParser(labels={})
self.assertEqual('foo', parser.label_for(0xFFD2, 'foo'))
def test_suite():
return unittest.findTestCases(sys.modules[__name__])