From d27bc832814c28a7d725e9c181de08ae11c73a30 Mon Sep 17 00:00:00 2001 From: sophie63 Date: Sat, 11 Apr 2015 10:27:31 -0700 Subject: [PATCH 1/2] sophie changed gitgoing and test_gitgoing --- gitgoing/gitgoing.py | 4 ++-- tests/test_gitgoing.py | 18 +++++++++--------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/gitgoing/gitgoing.py b/gitgoing/gitgoing.py index 375b900..7e8b6a8 100755 --- a/gitgoing/gitgoing.py +++ b/gitgoing/gitgoing.py @@ -57,7 +57,7 @@ def cv(x): cv : float The coefficient of variation of the entire array """ - return mean_plus_one(x)/std_plus_one(x) + return std_plus_one(x)/mean_plus_one(x) def is_neuron_component(component): - return component in NEURON_COMPONENTS \ No newline at end of file + return component in NEURON_COMPONENTS diff --git a/tests/test_gitgoing.py b/tests/test_gitgoing.py index 5d4b76c..f03406d 100755 --- a/tests/test_gitgoing.py +++ b/tests/test_gitgoing.py @@ -37,14 +37,14 @@ def test_std_plus_one(x_norm): true_std = np.std(x_norm) + 1 assert test_std == true_std -# def test_cv_broken(x_norm): -# from gitgoing.gitgoing import std_plus_one, mean_plus_one, cv -# -# test_cv = cv(x_norm) -# true_cv = std_plus_one(x_norm)/mean_plus_one(x_norm) -# -# # This test will fail -# assert test_cv == true_cv + def test_cv_broken(x_norm): + from gitgoing.gitgoing import std_plus_one, mean_plus_one, cv + + test_cv = cv(x_norm) + true_cv = std_plus_one(x_norm)/mean_plus_one(x_norm) + + # This test will fail + assert test_cv == true_cv @pytest.fixture(params=['soma', 'axon', 'synapse', 'dendrite', pytest.mark.xfail('fibroblast')]) @@ -56,4 +56,4 @@ def test_is_neuron_component(neuron_component): test_neuron_component = is_neuron_component(neuron_component) true_neuron_component = neuron_component in NEURON_COMPONENTS - assert test_neuron_component == true_neuron_component \ No newline at end of file + assert test_neuron_component == true_neuron_component From 02484dd8f7b47361fc35db5448e7ab19bfe744d7 Mon Sep 17 00:00:00 2001 From: sophie63 Date: Sat, 11 Apr 2015 10:45:24 -0700 Subject: [PATCH 2/2] corrected my own python mistakes --- tests/test_gitgoing.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/tests/test_gitgoing.py b/tests/test_gitgoing.py index f03406d..0362998 100755 --- a/tests/test_gitgoing.py +++ b/tests/test_gitgoing.py @@ -37,13 +37,12 @@ def test_std_plus_one(x_norm): true_std = np.std(x_norm) + 1 assert test_std == true_std - def test_cv_broken(x_norm): - from gitgoing.gitgoing import std_plus_one, mean_plus_one, cv +def test_cv_broken(x_norm): + from gitgoing.gitgoing import std_plus_one, mean_plus_one, cv - test_cv = cv(x_norm) - true_cv = std_plus_one(x_norm)/mean_plus_one(x_norm) + test_cv = cv(x_norm) + true_cv = std_plus_one(x_norm)/mean_plus_one(x_norm) - # This test will fail assert test_cv == true_cv @pytest.fixture(params=['soma', 'axon', 'synapse', 'dendrite',