def testFormatterCanDisplayStringEntity(self): # Should display the string that we supplied as the constructor formatter = Formatter("Test") self.assertEqual(str(formatter), '["Test"]()') # NewLabel should override the entity string name formatter.setLabel("NewLabel") self.assertEqual(str(formatter), '["NewLabel"]()')
def testCanSetTitleOfEntity(self): entity = FruitBowl(None) # Test Default title 'FruitBowl:Application' formatter = Formatter(entity) self.assertEqual(str(formatter), '[FruitBowl:Application](md5.png:Actual)') # Decorator should modify the title to 'CustomTitle' formatter.setLabel("CustomTitle") self.assertEqual(str(formatter), '["CustomTitle"](md5.png:Actual)')
def testCanDisplayRegionFinder(self): entity = FruitBowl(None) rf = entity.getRegionFinder() rf.addBaseline("fruitbowl[0]-0", 0) rf.addBaseline("fruitbowl[0]-1", 0) rf.addBaseline("fruitbowl[1]-0", 1) rf.addBaseline("fruitbowl[1]-1", 1) rf.addBaseline("fruitbowl[1]-2", 1) # NewLabel should override the entity string name formatter = Formatter(entity) self.assertEqual(str(formatter), '[FruitBowl:Application](md5.png:Actual)') # NewLabel should override the entity string name formatter.setLabel("MyImageRegion") self.assertEqual(str(formatter), '["MyImageRegion"](md5.png:Actual)')