Changeset 646


Ignore:
Timestamp:
Nov 27, 2015, 10:35:07 AM (4 years ago)
Author:
cito
Message:

Backport some more tests from trunk to 4.x

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/4.x/module/tests/test_classic_functions.py

    r641 r646  
    299299        pg.set_decimal_point('*')
    300300        r = pg.get_decimal_point()
     301        pg.set_decimal_point(point)
    301302        self.assertIsInstance(r, str)
    302303        self.assertEqual(r, '*')
    303         pg.set_decimal_point(point)
     304        r = pg.get_decimal_point()
     305        self.assertIsInstance(r, str)
     306        self.assertEqual(r, point)
     307
     308    def testGetDecimal(self):
     309        r = pg.get_decimal()
     310        self.assertIs(r, pg.Decimal)
    304311
    305312    def testSetDecimal(self):
    306313        decimal_class = pg.Decimal
    307         pg.set_decimal(long)
     314        pg.set_decimal(int)
     315        r = pg.get_decimal()
    308316        pg.set_decimal(decimal_class)
     317        self.assertIs(r, int)
     318        r = pg.get_decimal()
     319        self.assertIs(r, decimal_class)
     320
     321    def testGetBool(self):
     322        r = pg.get_bool()
     323        self.assertIsInstance(r, bool)
     324        self.assertIs(r, False)
     325
     326    def testSetBool(self):
     327        use_bool = pg.get_bool()
     328        pg.set_bool(True)
     329        r = pg.get_bool()
     330        pg.set_bool(use_bool)
     331        self.assertIsInstance(r, bool)
     332        self.assertIs(r, True)
     333        pg.set_bool(False)
     334        r = pg.get_bool()
     335        pg.set_bool(use_bool)
     336        self.assertIsInstance(r, bool)
     337        self.assertIs(r, False)
     338        r = pg.get_bool()
     339        self.assertIsInstance(r, bool)
     340        self.assertIs(r, use_bool)
     341
     342    def testGetNamedresult(self):
     343        r = pg.get_namedresult()
     344        self.assertIs(r, pg._namedresult)
    309345
    310346    def testSetNamedresult(self):
    311         pg.set_namedresult(lambda q: q.getresult())
    312         pg.set_namedresult(pg._namedresult)
     347        namedresult = pg.get_namedresult()
     348        f = lambda q: q.getresult()
     349        pg.set_namedresult(f)
     350        r = pg.get_namedresult()
     351        pg.set_namedresult(namedresult)
     352        self.assertIs(r, f)
     353        r = pg.get_namedresult()
     354        self.assertIs(r, namedresult)
    313355
    314356
  • trunk/module/tests/test_classic_functions.py

    r641 r646  
    361361        self.assertIs(r, False)
    362362
    363     def testSetBoool(self):
     363    def testSetBool(self):
    364364        use_bool = pg.get_bool()
    365365        pg.set_bool(True)
Note: See TracChangeset for help on using the changeset viewer.