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: # pragma: no cover warnings.warn('Could not reach Telecom Graphs. Corresponding test has not been performed.', RuntimeWarning) return load_netset()
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: # pragma: no cover 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)