From d43cda43b5983ddd1729f54c0f39c294a89ad631 Mon Sep 17 00:00:00 2001 From: Mike Naberezny Date: Mon, 23 Mar 2009 21:50:54 -0700 Subject: [PATCH] Added tests for AddressParser.label_for(). --- src/py65/tests/test_util.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/py65/tests/test_util.py b/src/py65/tests/test_util.py index 1a39b18..881c582 100644 --- a/src/py65/tests/test_util.py +++ b/src/py65/tests/test_util.py @@ -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__])