Author: cito
Date: Fri Nov 27 10:35:07 2015
New Revision: 646

Log:
Backport some more tests from trunk to 4.x

Modified:
   branches/4.x/module/tests/test_classic_functions.py
   trunk/module/tests/test_classic_functions.py

Modified: branches/4.x/module/tests/test_classic_functions.py
==============================================================================
--- branches/4.x/module/tests/test_classic_functions.py Fri Nov 27 10:22:56 
2015        (r645)
+++ branches/4.x/module/tests/test_classic_functions.py Fri Nov 27 10:35:07 
2015        (r646)
@@ -298,18 +298,60 @@
         point = pg.get_decimal_point()
         pg.set_decimal_point('*')
         r = pg.get_decimal_point()
+        pg.set_decimal_point(point)
         self.assertIsInstance(r, str)
         self.assertEqual(r, '*')
-        pg.set_decimal_point(point)
+        r = pg.get_decimal_point()
+        self.assertIsInstance(r, str)
+        self.assertEqual(r, point)
+
+    def testGetDecimal(self):
+        r = pg.get_decimal()
+        self.assertIs(r, pg.Decimal)
 
     def testSetDecimal(self):
         decimal_class = pg.Decimal
-        pg.set_decimal(long)
+        pg.set_decimal(int)
+        r = pg.get_decimal()
         pg.set_decimal(decimal_class)
+        self.assertIs(r, int)
+        r = pg.get_decimal()
+        self.assertIs(r, decimal_class)
+
+    def testGetBool(self):
+        r = pg.get_bool()
+        self.assertIsInstance(r, bool)
+        self.assertIs(r, False)
+
+    def testSetBool(self):
+        use_bool = pg.get_bool()
+        pg.set_bool(True)
+        r = pg.get_bool()
+        pg.set_bool(use_bool)
+        self.assertIsInstance(r, bool)
+        self.assertIs(r, True)
+        pg.set_bool(False)
+        r = pg.get_bool()
+        pg.set_bool(use_bool)
+        self.assertIsInstance(r, bool)
+        self.assertIs(r, False)
+        r = pg.get_bool()
+        self.assertIsInstance(r, bool)
+        self.assertIs(r, use_bool)
+
+    def testGetNamedresult(self):
+        r = pg.get_namedresult()
+        self.assertIs(r, pg._namedresult)
 
     def testSetNamedresult(self):
-        pg.set_namedresult(lambda q: q.getresult())
-        pg.set_namedresult(pg._namedresult)
+        namedresult = pg.get_namedresult()
+        f = lambda q: q.getresult()
+        pg.set_namedresult(f)
+        r = pg.get_namedresult()
+        pg.set_namedresult(namedresult)
+        self.assertIs(r, f)
+        r = pg.get_namedresult()
+        self.assertIs(r, namedresult)
 
 
 class TestModuleConstants(unittest.TestCase):

Modified: trunk/module/tests/test_classic_functions.py
==============================================================================
--- trunk/module/tests/test_classic_functions.py        Fri Nov 27 10:22:56 
2015        (r645)
+++ trunk/module/tests/test_classic_functions.py        Fri Nov 27 10:35:07 
2015        (r646)
@@ -360,7 +360,7 @@
         self.assertIsInstance(r, bool)
         self.assertIs(r, False)
 
-    def testSetBoool(self):
+    def testSetBool(self):
         use_bool = pg.get_bool()
         pg.set_bool(True)
         r = pg.get_bool()
_______________________________________________
PyGreSQL mailing list
[email protected]
https://mail.vex.net/mailman/listinfo.cgi/pygresql

Reply via email to