Changeset 3404 in products


Ignore:
Timestamp:
Apr 3, 2012 12:29:18 PM (8 years ago)
Author:
potar
Message:

fixed 'import PIL', pylint

Location:
quintagroup.analytics/branches/treemap/quintagroup/analytics
Files:
2 added
1 edited
2 moved

Legend:

Unmodified
Added
Removed
  • quintagroup.analytics/branches/treemap/quintagroup/analytics/browser/treemap.py

    r3372 r3404  
    390390                        text = field_name, font = font,  
    391391                        fill = self.getPilColor(treemap.data.color)) 
    392          
     392            return True 
     393 
    393394    def drawTreemap(self, treemap, image): 
    394395        """ Method generates treemap image """ 
  • quintagroup.analytics/branches/treemap/quintagroup/analytics/tests/test_treemap.py

    r3373 r3404  
    22from unittest import TestSuite, makeSuite, TestCase 
    33from itertools import izip 
     4from PIL import ImageDraw 
    45 
    56from quintagroup.analytics.browser.treemap import TreemapBTree, Treemap, \ 
     
    4748 
    4849 
    49 def createTreemap(cls = Treemap): 
     50def createTreemap(cls=Treemap): 
    5051    """ Method dedicated to create tests instance """ 
    5152    treemap = cls(x=0, y=0, w=100,h=100) 
     
    230231                self.assertAlmostEqual(x[0], x[1], 1)  
    231232 
    232 class TestTreemapHtml(unittest.TestCase): 
     233class TestTreemapImage(unittest.TestCase): 
    233234    """ Class dedicated to test treemap image """ 
    234235    def setUp(self): 
     
    242243        self.assertEqual(self.treemap.image.getbbox(), treemap.getbbox()) 
    243244        self.assertEqual(('R', 'G', 'B'), treemap.getbands()) 
    244         self.assertEqual((249, 241, 241), treemap.getpixel((10,10))) 
    245245     
    246246    def test_rgbHexToDecimal(self): 
     
    275275                          self.treemap.getPilColor('#fde5be')) 
    276276         
    277     def checkImage(self): 
    278         return len([x for x in self.treemap.image.tostring().split('\xff')  
    279                                if x != '']) 
     277#    def checkImage(self): 
     278#        return len([x for x in self.treemap.image.tostring().split('\xff')  
     279#                               if x != '']) 
    280280 
    281281    def test_writeText(self): 
    282         import ImageDraw 
     282        def istitle(self, result, width, height): 
     283            treemap = TreemapBTree(data=Treemap(w=width, h=height, x=0, y=0,  
     284                                                color='#fde5be', title = 'test')) 
     285            self.treemap.writeText(treemap, image) 
     286            self.assertEqual(result, self.treemap.writeText(treemap, image))  
     287  
    283288        image = ImageDraw.Draw(self.treemap.image) 
    284         treemap = TreemapBTree(data=Treemap(w=50, h=50, x=0, y=0,  
    285                                             color='#fde5be', title = 'test')) 
    286         self.treemap.writeText(treemap, image) 
    287         self.assertEqual(118, self.checkImage())  
    288      
     289 
     290        istitle(self, None, 10, 10) 
     291        istitle(self, True, 40, 40) 
     292 
     293    def test_drawTreemap(self): 
     294        image = ImageDraw.Draw(self.treemap.image) 
     295        self.assertEqual(None, self.treemap.drawTreemap(self.btree, image)) 
     296     
     297 
    289298def test_suite(): 
    290299    test_suite = unittest.TestSuite([]) 
     
    293302    test_suite.addTest(makeSuite(TestTreemap)) 
    294303    test_suite.addTest(makeSuite(TestTreemapHtml)) 
     304    test_suite.addTest(makeSuite(TestTreemapImage)) 
    295305    return test_suite 
    296306  
  • quintagroup.analytics/branches/treemap/quintagroup/analytics/tests/tests.py

    r3374 r3404  
    437437def test_suite(): 
    438438    from unittest import TestSuite, makeSuite 
    439     from quintagroup.analytics.test_treemap import \ 
    440                                       TestTreemapControl,\ 
    441                                       TestTreemapBTree,\ 
    442                                       TestTreemap,\ 
    443                                       TestTreemapHtml 
    444439 
    445440    test_suite = unittest.TestSuite([ 
     
    465460 
    466461        ]) 
    467     test_suite.addTest(makeSuite(TestTreemapControl)) 
    468     test_suite.addTest(makeSuite(TestTreemapBTree)) 
    469     test_suite.addTest(makeSuite(TestTreemap)) 
    470     test_suite.addTest(makeSuite(TestTreemapHtml)) 
    471  
     462    
    472463    test_suite.addTest(makeSuite(TestQAInstallation)) 
    473464    test_suite.addTest(makeSuite(TestOwnershipByType)) 
Note: See TracChangeset for help on using the changeset viewer.