dabo Commit
Revision 2772
Date: 2007-02-03 15:39:28 -0800 (Sat, 03 Feb 2007)
Author: Paul

Changed:
U   trunk/dabo/ui/uiwx/test/test_dTextBox.py

Log:
Added more tests to dTextBox, just making sure that when a textbox has
a None value, that the user can edit it and that it converts it to the
correct type (or reverts back to None if it can't convert it). It was
working fine but the tests confirm it.


Diff:
Modified: trunk/dabo/ui/uiwx/test/test_dTextBox.py
===================================================================
--- trunk/dabo/ui/uiwx/test/test_dTextBox.py    2007-02-03 23:27:45 UTC (rev 
2771)
+++ trunk/dabo/ui/uiwx/test/test_dTextBox.py    2007-02-03 23:39:28 UTC (rev 
2772)
@@ -32,6 +32,8 @@
                self.assertEqual(txt.Value, "23")
                txt.Value = None
                self.assertEqual(txt.Value, None)
+               self.mockUserInput("hi there")
+               self.assertEqual(txt.Value, "hi there")
 
        def testFloatValue(self):
                txt = self.txt
@@ -43,6 +45,11 @@
                self.assertEqual(txt.Value, 23)
                txt.Value = None
                self.assertEqual(txt.Value, None)
+               self.mockUserInput("hi there")
+               self.assertEqual(txt.Value, None)
+               self.mockUserInput("42")
+               self.assertEqual(txt.Value, 42)
+               self.assertTrue(isinstance(txt.Value, float))
 
 
        def testIntValue(self):
@@ -55,6 +62,11 @@
                self.assertEqual(txt.Value, 23)
                txt.Value = None
                self.assertEqual(txt.Value, None)
+               self.mockUserInput("hi there")
+               self.assertEqual(txt.Value, None)
+               self.mockUserInput("42")
+               self.assertEqual(txt.Value, 42)
+               self.assertTrue(isinstance(txt.Value, int))
 
        def testDateValue(self):
                txt = self.txt
@@ -66,6 +78,10 @@
                self.assertEqual(txt.Value, datetime.date(2006,5,3))
                txt.Value = None
                self.assertEqual(txt.Value, None)
+               self.mockUserInput("hi there")
+               self.assertEqual(txt.Value, None)
+               self.mockUserInput("2006-05-03")
+               self.assertEqual(txt.Value, datetime.date(2006,5,3))
 
        def testDateTimeValue(self):
                txt = self.txt
@@ -88,6 +104,11 @@
                self.assertEqual(txt.Value, decimal.Decimal("1.23"))
                txt.Value = None
                self.assertEqual(txt.Value, None)
+               self.mockUserInput("hi there")
+               self.assertEqual(txt.Value, None)
+               self.mockUserInput("42.23")
+               self.assertEqual(txt.Value, decimal.Decimal("42.23"))
+               self.assertTrue(isinstance(txt.Value, decimal.Decimal))
 
                
 if __name__ == "__main__":




_______________________________________________
Post Messages to: Dabo-dev@leafe.com
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-dev

Reply via email to