summaryrefslogtreecommitdiff
path: root/pypers/marelli/materiale/test_isnumber.py
diff options
context:
space:
mode:
Diffstat (limited to 'pypers/marelli/materiale/test_isnumber.py')
-rwxr-xr-xpypers/marelli/materiale/test_isnumber.py43
1 files changed, 43 insertions, 0 deletions
diff --git a/pypers/marelli/materiale/test_isnumber.py b/pypers/marelli/materiale/test_isnumber.py
new file mode 100755
index 0000000..f5acbf2
--- /dev/null
+++ b/pypers/marelli/materiale/test_isnumber.py
@@ -0,0 +1,43 @@
+# test_isnumber.py
+
+import unittest
+
+from isnumber import is_number
+
+class TestIsNumber(unittest.TestCase):
+
+ def setUp(self):
+ print "sto inizializzando"
+
+ # test positivi
+ def test_1(self):
+ "Testa che '1' è un numero buono."
+ self.assertTrue(is_number("1"))
+ def test_2(self):
+ "Testa che '1.3' è un numero buono."
+ self.assertTrue(is_number("1.3"))
+ def test_3(self):
+ "Testa che '+1.3' è un numero buono."
+ self.assertTrue(is_number("+1.3"))
+ def test_4(self):
+ "Testa che '-1.3' è un numero buono."
+ self.assertTrue(is_number("-1.3"))
+
+ # test negativi
+ def test_5(self):
+ "Testa che '1-.3' non è un numero buono."
+ self.assertFalse(is_number("1-.3"))
+ def test_6(self):
+ "Testa che 'à non è un numero buono."
+ self.assertFalse(is_number("a"))
+ def test_7(self):
+ "Testa che '42' è un numero buono."
+ self.assertTrue(is_number("42"))
+
+ def tearDown(self):
+ print "Sto chiudendo quello che c'è da chiudere"
+
+if __name__ == "__main__":
+ unittest.main()
+
+