def test_conditional_means_selector():
    ' test ConditionalMeansSelector class '
    cms = ConditionalMeansSelector(f_pearson)
    test_y = np.asarray([3, 2, 1, 0, 3, 2, 1, 0])
    test_x = np.asarray([[0, 3], [5, 2], [9, 1], [13, 0], [0, 3], [5, 2], [9, 1], [13, 0]])
    (rs_cond_means, ps_cond_means) = cms.selector_function(test_x, test_y)
    nose.tools.assert_almost_equal(1.0, rs_cond_means[0], delta=1e-06)
    nose.tools.assert_almost_equal(1.0, rs_cond_means[1], delta=1e-06)
    nose.tools.assert_almost_equal(0.0, ps_cond_means[0], delta=1e-06)
    nose.tools.assert_almost_equal(0.0, ps_cond_means[1], delta=1e-06)
    (rs_cond_means_wrong, _) = f_pearson(test_x, test_y)
    nose.tools.assert_not_almost_equal(1.0, rs_cond_means_wrong[0], delta=1e-06)
    cms_pairwise = ConditionalMeansSelector(pearsonr, True)
    (rs_cond_means_pw, ps_cond_means_pw) = cms_pairwise.selector_function(test_x, test_y)
    nose.tools.assert_almost_equal(1.0, rs_cond_means_pw[0], delta=1e-06)
    nose.tools.assert_almost_equal(1.0, rs_cond_means_pw[1], delta=1e-06)
    nose.tools.assert_almost_equal(0.0, ps_cond_means_pw[0], delta=1e-06)
    nose.tools.assert_almost_equal(0.0, ps_cond_means_pw[1], delta=1e-06)
test ConditionalMeansSelector class
def test_conditional_means_selector():
    '  '
    cms = ConditionalMeansSelector(f_pearson)
    test_y = np.asarray([3, 2, 1, 0, 3, 2, 1, 0])
    test_x = np.asarray([[0, 3], [5, 2], [9, 1], [13, 0], [0, 3], [5, 2], [9, 1], [13, 0]])
    (rs_cond_means, ps_cond_means) = cms.selector_function(test_x, test_y)
    nose.tools.assert_almost_equal(1.0, rs_cond_means[0], delta=1e-06)
    nose.tools.assert_almost_equal(1.0, rs_cond_means[1], delta=1e-06)
    nose.tools.assert_almost_equal(0.0, ps_cond_means[0], delta=1e-06)
    nose.tools.assert_almost_equal(0.0, ps_cond_means[1], delta=1e-06)
    (rs_cond_means_wrong, _) = f_pearson(test_x, test_y)
    nose.tools.assert_not_almost_equal(1.0, rs_cond_means_wrong[0], delta=1e-06)
    cms_pairwise = ConditionalMeansSelector(pearsonr, True)
    (rs_cond_means_pw, ps_cond_means_pw) = cms_pairwise.selector_function(test_x, test_y)
    nose.tools.assert_almost_equal(1.0, rs_cond_means_pw[0], delta=1e-06)
    nose.tools.assert_almost_equal(1.0, rs_cond_means_pw[1], delta=1e-06)
    nose.tools.assert_almost_equal(0.0, ps_cond_means_pw[0], delta=1e-06)
    nose.tools.assert_almost_equal(0.0, ps_cond_means_pw[1], delta=1e-06)