SciPy
Need help? Have a feature request? Please check out the tethne-users group .

Source code for tethne.tests.test_networks_authors

import sys
sys.path.append('./')

import unittest

import networkx as nx

from tethne.readers.wos import read
from tethne.networks.authors import author_papers, coauthors

datapath = './tethne/tests/data/wos.txt'


[docs]class TestAuthorPapers(unittest.TestCase):
[docs] def setUp(self): self.corpus = read(datapath)
[docs] def test_author_papers(self): g = author_papers(self.corpus) N_authors = len(self.corpus.indices['authors']) N_papers = len(self.corpus.papers) # A node for every paper and for every author. self.assertEqual(g.order(), N_authors + N_papers)
[docs]class TestCoauthors(unittest.TestCase):
[docs] def setUp(self): self.corpus = read(datapath)
[docs] def test_author_papers(self): g = coauthors(self.corpus) N_authors = len(self.corpus.indices['authors']) # A node for every author. self.assertEqual(g.order(), N_authors)
if __name__ == '__main__': unittest.main()