aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexanderlacuna2020-10-27 12:37:02 +0300
committerAlexanderlacuna2020-10-27 12:37:02 +0300
commit09bae9afdde636b84c8e42140f21ba3f60903d9b (patch)
tree24e6589af3edd691288819650cace259a205dc5d
parent76f425b1e76debe90f723c99594236853b05b979 (diff)
downloadgenenetwork2-09bae9afdde636b84c8e42140f21ba3f60903d9b.tar.gz
modified to use pep8 standards
-rw-r--r--wqflask/tests/wqflask/show_trait/test_export_trait_data.py59
1 files changed, 30 insertions, 29 deletions
diff --git a/wqflask/tests/wqflask/show_trait/test_export_trait_data.py b/wqflask/tests/wqflask/show_trait/test_export_trait_data.py
index f77f11c9..c64196ff 100644
--- a/wqflask/tests/wqflask/show_trait/test_export_trait_data.py
+++ b/wqflask/tests/wqflask/show_trait/test_export_trait_data.py
@@ -1,54 +1,56 @@
import unittest
-from wqflask.show_trait.export_trait_data import dict_to_sorted_list,cmp_samples
-class TestDictionaryList(unittest.TestCase):
- def setUp(self):
- self.sample1={
+from wqflask.show_trait.export_trait_data import dict_to_sorted_list
+from wqflask.show_trait.export_trait_data import cmp_samples
+
+class TestExportTraits(unittest.TestCase):
+ def test_dict_to_sortedlist(self):
+ '''Test for conversion of dict to sorted list'''
+ sample1={
"other":"exp1",
"name":"exp2"
}
- self.sample2={
+ sample2={
'se':1,
'num_cases':4,
'value':6,
"name":3
}
- self.reversed={
+ rever={
"name":3,
'value':6,
'num_cases':4,
'se':1
}
- self.oneItem={
+ oneItem={
'item1':"one"
}
- def test_dict_to_sortedlist(self):
- '''Test for converting dict to sorted list'''
-
- self.assertEqual(['exp2','exp1'],dict_to_sorted_list(self.sample1))
- self.assertEqual([3, 6, 1, 4],dict_to_sorted_list(self.sample2))
- self.assertEqual([3, 6, 1, 4],dict_to_sorted_list(self.reversed))
- self.assertEqual(["one"],dict_to_sorted_list(self.oneItem))
+
+
+ self.assertEqual(['exp2','exp1'],dict_to_sorted_list(sample1))
+ self.assertEqual([3, 6, 1, 4],dict_to_sorted_list(sample2))
+ self.assertEqual([3, 6, 1, 4],dict_to_sorted_list(rever))
+ self.assertEqual(["one"],dict_to_sorted_list(oneItem))
'''test that the func returns the values not the keys'''
- self.assertFalse(['other','name']==['exp2','exp1'])
+ self.assertFalse(['other','name']==dict_to_sorted_list(sample1))
+ def test_cmp_samples(self):
+ '''test for function that does comparisons of samples'''
-class TestComparison(unittest.TestCase):
- def setUp(self):
- self.sampleA=[
+ sampleA=[
[
('value','other'),
('name','test_name')
]
]
- self.sampleB=[
+ sampleB=[
[
('value','other'),
('unknown','test_name')
]
]
- self.sampleC=[
+ sampleC=[
[('other',"value"),
('name','value')
],
@@ -82,20 +84,19 @@ class TestComparison(unittest.TestCase):
('other_b',"val"
)
]]
+ results=[cmp_samples(val[0],val[1]) for val in sampleA]
+ resultB=[cmp_samples(val[0],val[1]) for val in sampleB]
+ resultC=[cmp_samples(val[0],val[1]) for val in sampleC]
+ self.assertEqual(1,*results)
+ self.assertEqual(-1,*resultB)
+ self.assertEqual([1, -1, 1, -1, -1, 1, -1, -1],resultC)
+
+
- def test_cmp_samples(self):
- '''Test for func that does sample comparisons'''
-
- results=[cmp_samples(val[0],val[1]) for val in self.sampleA]
- resultB=[cmp_samples(val[0],val[1]) for val in self.sampleB]
- resultC=[cmp_samples(val[0],val[1]) for val in self.sampleC]
- self.assertEqual(1,*results)
- self.assertEqual(-1,*resultB)
- self.assertEqual([1, -1, 1, -1, -1, 1, -1, -1],resultC)