def testViewTree(self): root = View({'root':1}, None) children = ["A", "B", "C"] for s in children: root.add(View({s:1}, None)) self.assertEquals(len(children), len(root.children))
def testInexistentMethodName(self): v = View({'foo':1}, None) try: v.bar() raise Exception("AttributeError not raised") except AttributeError: pass
def testViewTreeParent(self): root = View({'root':1}, None) children = ["A", "B", "C"] for s in children: root.add(View({s:1}, None)) for ch in root.children: self.assertTrue(ch.parent == root)
def testNameWith2Colons_this_is_another_fake_name(self): v = View({'this:is:another_fake_name':1}, None) self.assertEqual(1, v.this_is_another_fake_name())
def testNameWithColon_this_is_a_fake_name(self): v = View({'this:is_a_fake_name':1}, None) self.assertEqual(1, v.this_is_a_fake_name())
def testName_Layout_mLeft(self): v = View({'layout:mLeft':200}, None) self.assertEqual(200, v.layout_mLeft())
def testInnerMethod(self): v = View({'isChecked()':'true'}, None) self.assertTrue(v.isChecked()) v.map['isChecked()'] = 'false' self.assertFalse(v.isChecked(), "Expected False but is %s {%s}" % (v.isChecked(), v.map['isChecked()']) ) self.assertFalse(v.isChecked()) v.map['other'] = 1 self.assertEqual(1, v.other()) v.map['evenMore'] = "ABC" self.assertEqual("ABC", v.evenMore()) v.map['more'] = "abc" v.map['more'] = v.evenMore() self.assertEqual("ABC", v.more()) v.map['isMore()'] = 'true' self.assertTrue(v.isMore())