Ejemplo n.º 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))
Ejemplo n.º 2
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.assertEqual(
         outDict, expectedDict,
         '%r != %r' % (outDict._modules, expectedDict._modules))
Ejemplo n.º 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))
Ejemplo n.º 4
0
    def testUpdate(self):
        total = ModuleDict()
        total.enterModule('mod1')
        total.enterClass('cls1', [], 'doc1')
        total.enterModule('mod2')
        total.enterClass('cls2', [], 'doc2')

        self.assertEqual(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.assertEqual(pformat(md3), pformat(md1))
        md3.update(md2)
        self.assertEqual(pformat(md3), pformat(total))
        md3.update(None)
        self.assertEqual(pformat(md3), pformat(total))