Commit 13227e14 authored by Paul McCarthy's avatar Paul McCarthy 🚵
Browse files

TEST: Suppress/avoid warnings

parent 3a285af0
......@@ -11,7 +11,7 @@ import string
import textwrap as tw
import multiprocessing as mp
from unittest import mock
from unittest import mock
import pytest
......@@ -514,10 +514,12 @@ def test_applyChildValues():
6 : 'text',
7 : 'integer'})
vartable.loc[pvals.keys(), 'ParentValues'] = \
[lt.convert_ParentValues(v) for v in pvals.values()]
vartable.loc[cvals.keys(), 'ChildValues'] = \
[lt.convert_comma_sep_text(v) for v in cvals.values()]
vartable.loc[pvals.keys(), 'ParentValues'] = np.array(
[lt.convert_ParentValues(v) for v in pvals.values()],
dtype=object)
vartable.loc[cvals.keys(), 'ChildValues'] = np.array(
[lt.convert_comma_sep_text(v) for v in cvals.values()],
dtype=object)
finfo = fileinfo.FileInfo('data.txt')
dt, _ = importing.importData(finfo,
......
......@@ -349,10 +349,12 @@ def wrapped_pairwiseRedundantColumns(df, corrthres):
return core.pairwiseRedundantColumns(df, colpairs, corrthres)
def test_pairwiseRedundantColumns():
_test_redundantColumns(wrapped_pairwiseRedundantColumns)
with np.errstate(divide='ignore'):
_test_redundantColumns(wrapped_pairwiseRedundantColumns)
def test_matrixRedundantColumns():
_test_redundantColumns(core.matrixRedundantColumns)
with np.errstate(divide='ignore'):
_test_redundantColumns(core.matrixRedundantColumns)
def _test_redundantColumns(rcfunc):
......@@ -382,10 +384,12 @@ def _test_redundantColumns(rcfunc):
def test_pairwiseRedundantColumns_associative():
_test_redundantColumns_associative(wrapped_pairwiseRedundantColumns)
with np.errstate(divide='ignore'):
_test_redundantColumns_associative(wrapped_pairwiseRedundantColumns)
def test_matrixRedundantColumns_associative():
_test_redundantColumns_associative(core.matrixRedundantColumns)
with np.errstate(divide='ignore'):
_test_redundantColumns_associative(core.matrixRedundantColumns)
def _test_redundantColumns_associative(rcfunc):
......@@ -452,12 +456,13 @@ def test_redundantColumns_na():
nathres = np.abs(nacorr[~np.isclose(nacorr, 1)]).mean()
corrthres = np.abs(dcorr[ ~np.isclose(dcorr, 1)]).mean()
nacorr = core.naCorrelation(pd.isna(df), nathres)
colpairs = np.where(np.triu(nacorr, k=1))
colpairs = np.vstack(colpairs).T
with np.errstate(divide='ignore'):
nacorr = core.naCorrelation(pd.isna(df), nathres)
colpairs = np.where(np.triu(nacorr, k=1))
colpairs = np.vstack(colpairs).T
pairwise = core.pairwiseRedundantColumns(df, colpairs, corrthres)
matrix = core.matrixRedundantColumns( df, corrthres, nathres)
pairwise = core.pairwiseRedundantColumns(df, colpairs, corrthres)
matrix = core.matrixRedundantColumns( df, corrthres, nathres)
nacounts = np.isnan(data).sum(axis=0)
corrmask = nacorr & (np.abs(dcorr) > corrthres)
......@@ -498,12 +503,12 @@ def test_redundantColumns_constant_allna():
data[9, 1] = np.nan
df = pd.DataFrame(data.T)
nacorr = core.naCorrelation(pd.isna(df), 0.1)
colpairs = np.where(np.triu(nacorr, k=1))
colpairs = np.vstack(colpairs).T
pairwise = core.pairwiseRedundantColumns(df, colpairs, 0.2)
matrix = core.matrixRedundantColumns( df, 0.2, 0.1)
with np.errstate(divide='ignore'):
nacorr = core.naCorrelation(pd.isna(df), 0.1)
colpairs = np.where(np.triu(nacorr, k=1))
colpairs = np.vstack(colpairs).T
pairwise = core.pairwiseRedundantColumns(df, colpairs, 0.2)
matrix = core.matrixRedundantColumns( df, 0.2, 0.1)
pairwise = np.array(sorted(pairwise))
matrix = np.array(sorted(matrix))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment