summaryrefslogtreecommitdiff
path: root/networkx/tests
diff options
context:
space:
mode:
authorDan Schult <dschult@colgate.edu>2019-10-09 15:00:37 -0400
committerJarrod Millman <jarrod.millman@gmail.com>2019-10-12 09:21:57 -0700
commitecc8fcd1f2c8da30457082ba6ec6e64759ca174f (patch)
tree29281002ac02eddfcd03ca54c52365427308034a /networkx/tests
parent373ae4fdffee233e5d59374114003f5238ab522f (diff)
downloadnetworkx-ecc8fcd1f2c8da30457082ba6ec6e64759ca174f.tar.gz
Fix some __init__ warnings
Diffstat (limited to 'networkx/tests')
-rw-r--r--networkx/tests/test_convert_numpy.py5
-rw-r--r--networkx/tests/test_convert_pandas.py9
-rw-r--r--networkx/tests/test_convert_scipy.py2
3 files changed, 6 insertions, 10 deletions
diff --git a/networkx/tests/test_convert_numpy.py b/networkx/tests/test_convert_numpy.py
index ea73ba43..8ecfcbcb 100644
--- a/networkx/tests/test_convert_numpy.py
+++ b/networkx/tests/test_convert_numpy.py
@@ -19,7 +19,7 @@ class TestConvertNumpy(object):
except ImportError:
raise SkipTest('NumPy not available.')
- def __init__(self):
+ def setup_method(self):
self.G1 = barbell_graph(10, 3)
self.G2 = cycle_graph(10, create_using=nx.DiGraph)
@@ -262,10 +262,9 @@ class TestConvertNumpyArray(object):
except ImportError:
raise SkipTest('NumPy not available.')
- def __init__(self):
+ def setup_method(self):
self.G1 = barbell_graph(10, 3)
self.G2 = cycle_graph(10, create_using=nx.DiGraph)
-
self.G3 = self.create_weighted(nx.Graph())
self.G4 = self.create_weighted(nx.DiGraph())
diff --git a/networkx/tests/test_convert_pandas.py b/networkx/tests/test_convert_pandas.py
index 6c6e3b64..eac95907 100644
--- a/networkx/tests/test_convert_pandas.py
+++ b/networkx/tests/test_convert_pandas.py
@@ -7,19 +7,15 @@ from networkx.testing import assert_nodes_equal, assert_edges_equal, \
class TestConvertPandas(object):
- numpy = 1 # nosetests attribute, use nosetests -a 'not numpy' to skip test
-
@classmethod
def setup_class(cls):
+ global pd
try:
import pandas as pd
except ImportError:
raise SkipTest('Pandas not available.')
- def __init__(self):
- global pd
- import pandas as pd
-
+ def setup_method(self):
self.rng = pd.np.random.RandomState(seed=5)
ints = self.rng.randint(1, 11, size=(3, 2))
a = ['A', 'B', 'C']
@@ -28,6 +24,7 @@ class TestConvertPandas(object):
df[0] = a # Column label 0 (int)
df['b'] = b # Column label 'b' (str)
self.df = df
+
mdf = pd.DataFrame([[4, 16, 'A', 'D']],
columns=['weight', 'cost', 0, 'b'])
self.mdf = df.append(mdf)
diff --git a/networkx/tests/test_convert_scipy.py b/networkx/tests/test_convert_scipy.py
index e074237c..2fcf92af 100644
--- a/networkx/tests/test_convert_scipy.py
+++ b/networkx/tests/test_convert_scipy.py
@@ -18,7 +18,7 @@ class TestConvertNumpy(object):
except ImportError:
raise SkipTest('SciPy sparse library not available.')
- def __init__(self):
+ def setup_method(self):
self.G1 = barbell_graph(10, 3)
self.G2 = cycle_graph(10, create_using=nx.DiGraph)