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))
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))
def testAddPointer(self): md = ModuleDict() md.addPointer('something', 'other') self.assertEquals(md['POINTERS'], {'something': 'other'})
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))
def testAddPointer(self): md = ModuleDict() md.addPointer('something', 'other') self.assertEqual(md['POINTERS'], {'something': 'other'})
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))