コード例 #1
0
    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"]()')
コード例 #2
0
 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"]()')
コード例 #3
0
 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)')
コード例 #4
0
    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)')
コード例 #5
0
 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)')
コード例 #6
0
    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)')