Пример #1
0
 def testAnalyzeFile(self):
     path = os.path.abspath('File.py')
     source = dedent("""\
         CONSTANT = 1
     """)
     expectedDict = ModuleDict()
     expectedDict.enterModule('File')
     expectedDict.addProperty(None, 'CONSTANT')
     outDict = analyzeFile(path, source, )
     self.assertEquals(outDict, expectedDict, '%r != %r' % (outDict._modules, expectedDict._modules))
Пример #2
0
 def testAddPointer(self):
     md = ModuleDict()
     md.addPointer('something', 'other')
     self.assertEquals(md['POINTERS'], {'something': 'other'})
Пример #3
0
    def testUpdate(self):
        total = ModuleDict()
        total.enterModule('mod1')
        total.enterClass('cls1', [], 'doc1')
        total.enterModule('mod2')
        total.enterClass('cls2', [], 'doc2')

        self.assertEquals(pformat(total), pformat(total._modules))

        md1 = ModuleDict()
        md1.enterModule('mod1')
        md1.enterClass('cls1', [], 'doc1')

        md2 = ModuleDict()
        md2.enterModule('mod2')
        md2.enterClass('cls2', [], 'doc2')

        md3 = ModuleDict()
        md3.update(md1)
        self.assertEquals(pformat(md3), pformat(md1))
        md3.update(md2)
        self.assertEquals(pformat(md3), pformat(total))
        md3.update(None)
        self.assertEquals(pformat(md3), pformat(total))