def test_diffusionCounts(self): d = metaknowledge.diffusionCount(self.RC, self.RC) dc = metaknowledge.diffusionCount(self.RC, self.RC, compareCounts = True) dWC = metaknowledge.diffusionCount(self.RC, self.RC, sourceType = "WC") self.assertIsInstance(d.keys().__iter__().__next__(), metaknowledge.Record) self.assertTrue(-1 < d.values().__iter__().__next__() < 10) self.assertIsInstance(list(dWC.keys())[0], str) self.assertTrue(-1 < dWC.values().__iter__().__next__() < 24) for t in dc.values(): self.assertEqual(t[0], t[1])
def test_diffusionCounts(self): d = metaknowledge.diffusionCount(self.RC, self.RC) dc = metaknowledge.diffusionCount(self.RC, self.RC, compareCounts=True) dWC = metaknowledge.diffusionCount(self.RC, self.RC, sourceType="WC") self.assertIsInstance(d.keys().__iter__().__next__(), metaknowledge.Record) self.assertTrue(-1 < d.values().__iter__().__next__() < 10) self.assertIsInstance(list(dWC.keys())[0], str) self.assertTrue(-1 < dWC.values().__iter__().__next__() < 24) for t in dc.values(): self.assertEqual(t[0], t[1])
def test_diffusionPandas(self): d = metaknowledge.diffusionCount(self.RC, self.RC, pandasFriendly = True) dwc = metaknowledge.diffusionCount(self.RC, self.RC, pandasFriendly = True, sourceType = "WC", compareCounts = True) dyear = metaknowledge.diffusionCount(self.RC, self.RC, pandasFriendly = True, extraValue = 'year') self.assertTrue("TI" in d.keys()) self.assertEqual(len(d), 44) self.assertTrue(len(d["UT"]), len(self.RC)) self.assertTrue("WC" in dwc) self.assertEqual(3, len(dwc)) self.assertEqual(len(dwc["TargetCount"]), 9) self.assertEqual(dwc["TargetCount"], dwc["SourceCount"]) self.assertEqual(len(dyear), len(d) + 1) self.assertNotEqual(dyear["TargetCount"], dwc["SourceCount"]) self.assertEqual(len([c for c in dyear["TargetCount"] if c > 1]), 9) self.assertTrue(1979 in dyear['year'])
def test_diffusionPandas(self): d = metaknowledge.diffusionCount(self.RC, self.RC, pandasFriendly=True) dwc = metaknowledge.diffusionCount(self.RC, self.RC, pandasFriendly=True, sourceType="WC", compareCounts=True) dyear = metaknowledge.diffusionCount(self.RC, self.RC, pandasFriendly=True, extraValue='year') self.assertTrue("TI" in d.keys()) self.assertEqual(len(d), 44) self.assertTrue(len(d["UT"]), len(self.RC)) self.assertTrue("WC" in dwc) self.assertEqual(3, len(dwc)) self.assertEqual(len(dwc["TargetCount"]), 9) self.assertEqual(dwc["TargetCount"], dwc["SourceCount"]) self.assertEqual(len(dyear), len(d) + 1) self.assertNotEqual(dyear["TargetCount"], dwc["SourceCount"]) self.assertEqual(len([c for c in dyear["TargetCount"] if c > 1]), 9) self.assertTrue(1979 in dyear['year'])