Changeset 604


Ignore:
Timestamp:
Nov 22, 2015, 1:19:02 PM (4 years ago)
Author:
cito
Message:

Allow for several variations of the locale names

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/module/TEST_PyGreSQL_classic_connection.py

    r603 r604  
    10031003        # if and only if the decimal point is set appropriately
    10041004        # for the current lc_monetary setting
    1005         query("set lc_monetary='en_US.UTF-8'")
     1005        # first try with English localization (using the point)
     1006        for lc in 'en', 'en_US', 'en_US.utf8', 'en_US.UTF-8':
     1007            try:
     1008                query("set lc_monetary='%s'" % lc)
     1009            except pg.ProgrammingError:
     1010                pass
     1011            else:
     1012                break
     1013        else:
     1014            self.fail("Cannot set English money locale")
    10061015        pg.set_decimal_point('.')
    10071016        r = query("select '34.25'::money").getresult()[0][0]
     
    10111020        r = query("select '34.25'::money").getresult()[0][0]
    10121021        self.assertNotEqual(r, d('34.25'))
    1013         query("set lc_monetary='de_DE.UTF-8'")
     1022        # first try with German localization (using the comma)
     1023        for lc in 'de', 'de_DE', 'de_DE.utf8', 'de_DE.UTF-8':
     1024            try:
     1025                query("set lc_monetary='%s'" % lc)
     1026            except pg.ProgrammingError:
     1027                pass
     1028            else:
     1029                break
     1030        else:
     1031            self.fail("Cannot set English money locale")
    10141032        pg.set_decimal_point(',')
    10151033        r = query("select '34,25'::money").getresult()[0][0]
Note: See TracChangeset for help on using the changeset viewer.