Beispiel #1
0
 def test_invalid_konect(self):
     tmp_data_dir = tempfile.gettempdir() + '/stub'
     clear_data_home(tmp_data_dir)
     try:
         with self.assertRaises(ValueError):
             load_konect('junk', tmp_data_dir)
     except URLError:
         warnings.warn(
             'Could not reach Konect. Corresponding test has not been performed.',
             RuntimeWarning)
         return
    def test_invalid_netset(self):
        tmp_data_dir = tempfile.gettempdir() + '/stub'
        clear_data_home(tmp_data_dir)
        try:
            with self.assertRaises(ValueError):
                load_netset('junk', tmp_data_dir)

        except URLError:  # pragma: no cover
            warnings.warn(
                'Could not reach Telecom Graphs. Corresponding test has not been performed.',
                RuntimeWarning)
            return
        load_netset()
Beispiel #3
0
 def test_wikilinks(self):
     tmp_data_dir = tempfile.gettempdir() + '/stub'
     clear_data_home(tmp_data_dir)
     try:
         data = load_wikilinks_dataset('stub', tmp_data_dir)
     except URLError:
         warnings.warn(
             'Could not reach Telecom Graphs. Corresponding test has not been performed.',
             RuntimeWarning)
         return
     self.assertEqual(data.biadjacency.shape[0], 1)
     self.assertEqual(data.names.shape[0], 2)
     clear_data_home(tmp_data_dir)
Beispiel #4
0
 def test_netset(self):
     tmp_data_dir = tempfile.gettempdir() + '/stub'
     clear_data_home(tmp_data_dir)
     try:
         graph = load_netset('stub', tmp_data_dir)
     except URLError:
         warnings.warn(
             'Could not reach Telecom Graphs. Corresponding test has not been performed.',
             RuntimeWarning)
         return
     n = 2
     self.assertEqual(graph.adjacency.shape, (n, n))
     self.assertEqual(len(graph.names), n)
     clear_data_home(tmp_data_dir)
Beispiel #5
0
 def test_konect(self):
     tmp_data_dir = tempfile.gettempdir() + '/moreno_crime'
     clear_data_home(tmp_data_dir)
     try:
         data = load_konect('moreno_crime', tmp_data_dir)
     except URLError:
         warnings.warn(
             'Could not reach Konect. Corresponding test has not been performed.',
             RuntimeWarning)
         return
     self.assertEqual(data.biadjacency.shape[0], 829)
     self.assertEqual(data.name.shape[0], 829)
     data = load_konect('moreno_crime', tmp_data_dir)
     self.assertEqual(data.biadjacency.shape[0], 829)
     self.assertEqual(data.name.shape[0], 829)
     clear_data_home(tmp_data_dir)