[hamster-applet] updated so tests now run again
- From: Toms Baugis <tbaugis src gnome org>
- To: svn-commits-list gnome org
- Subject: [hamster-applet] updated so tests now run again
- Date: Wed, 20 May 2009 09:55:00 -0400 (EDT)
commit 9822409c022f4483f67f1200a7bc5a999e58230e
Author: Toms Bauģis <toms baugis gmail com>
Date: Wed May 20 14:18:39 2009 +0100
updated so tests now run again
---
tests/charting_test.py | 26 +++++++++++++++++---------
1 files changed, 17 insertions(+), 9 deletions(-)
diff --git a/tests/charting_test.py b/tests/charting_test.py
index fbe371c..bf369b9 100644
--- a/tests/charting_test.py
+++ b/tests/charting_test.py
@@ -3,48 +3,56 @@ import sys, os.path
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "..")))
import unittest
-from hamster import graphics
+from hamster import graphics, charting
class TestIteratorFunctions(unittest.TestCase):
def test_target_bigger(self):
- integrator = graphics.Integrator(0, 0)
+ # targetting up
+ integrator = graphics.Integrator(0)
integrator.target(10)
integrator.update()
assert 0 < integrator.value < 10, "not going up as expected %f" \
% integrator.value
def test_target_lesser(self):
- integrator = graphics.Integrator(0, 0)
+ # targetting down
+ integrator = graphics.Integrator(0)
integrator.target(-10)
integrator.update()
assert -10 < integrator.value < 0, "not going down as expected %f" \
% integrator.value
def test_reaches_target(self):
- integrator = graphics.Integrator(0, 0)
+ # target is reached
+ integrator = graphics.Integrator(0)
integrator.target(10)
while integrator.update():
pass
- assert round(integrator.value, 0) == 10
+ self.assertEquals(round(integrator.value, 0), 10)
class TestSizeListFunctions(unittest.TestCase):
def test_values_stay(self):
+ # on shrinkage, values are kept
list_a = [1, [2, 3, 4], 5]
list_b = [6, [7, 8]]
res = charting.size_list(list_a, list_b)
- assert res == [1, [2, 3]], "on shrinkage, values are kept, %s" % res
+ self.assertEquals(res, [1, [2, 3]])
def test_grow(self):
+ # source table expands
list_a = [1, [2, 3], 4]
list_b = [5, [6, 7, 8], 9, 10]
res = charting.size_list(list_a, list_b)
- assert res == [1, [2, 3, 8], 4, 10], "source table expands, %s" % res
+ self.assertEquals(res , [1, [2, 3, 8], 4, 10])
class TestGetLimits(unittest.TestCase):
def test_simple(self):
min_v, max_v = charting.get_limits([4, 7, 2, 4, 6, 12, 3, 1, 9])
- assert min_v == 1, "wrong minimal: %d" % min_v
- assert max_v == 12, "wrong maximal: %d" % max_v
+ # correct min
+ self.assertEquals(min_v, 1)
+
+ # correct max
+ self.assertEquals(max_v, 12)
if __name__ == '__main__':
unittest.main()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]