Back to index

python3.2  3.2.2
Public Member Functions | Public Attributes | Static Public Attributes
test.test_locale.TestEnUSNumberFormatting Class Reference
Inheritance diagram for test.test_locale.TestEnUSNumberFormatting:
Inheritance graph
[legend]
Collaboration diagram for test.test_locale.TestEnUSNumberFormatting:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def setUp
def test_currency
def tearDown
def test_grouping
def test_grouping_and_padding
def test_integer_grouping
def test_integer_grouping_and_padding
def test_simple
def test_padding
def test_complex_formatting

Public Attributes

 sep
_PyObject_HEAD_EXTRA Py_ssize_t ob_refcnt
struct _typeobjectob_type

Static Public Attributes

dictionary cooked_values

Detailed Description

Definition at line 271 of file test_locale.py.


Member Function Documentation

Reimplemented from test.test_locale.EnUSNumberFormatting.

Definition at line 274 of file test_locale.py.

00274 
00275     def setUp(self):
00276         EnUSCookedTest.setUp(self)
00277         EnUSNumberFormatting.setUp(self)

Here is the caller graph for this function:

def test.test_locale.BaseCookedTest.tearDown (   self) [inherited]

Definition at line 61 of file test_locale.py.

00061 
00062     def tearDown(self):
00063         locale._override_localeconv = {}

Here is the caller graph for this function:

Definition at line 203 of file test_locale.py.

00203 
00204     def test_complex_formatting(self):
00205         # Spaces in formatting string
00206         self._test_format_string("One million is %i", 1000000, grouping=1,
00207             out='One million is 1%s000%s000' % (self.sep, self.sep))
00208         self._test_format_string("One  million is %i", 1000000, grouping=1,
00209             out='One  million is 1%s000%s000' % (self.sep, self.sep))
00210         # Dots in formatting string
00211         self._test_format_string(".%f.", 1000.0, out='.1000.000000.')
00212         # Padding
00213         if self.sep:
00214             self._test_format_string("-->  %10.2f", 4200, grouping=1,
00215                 out='-->  ' + ('4%s200.00' % self.sep).rjust(10))
00216         # Asterisk formats
00217         self._test_format_string("%10.*f", (2, 1000), grouping=0,
00218             out='1000.00'.rjust(10))
00219         if self.sep:
00220             self._test_format_string("%*.*f", (10, 2, 1000), grouping=1,
00221                 out=('1%s000.00' % self.sep).rjust(10))
00222         # Test more-in-one
00223         if self.sep:
00224             self._test_format_string("int %i float %.2f str %s",
00225                 (1000, 1000.0, 'str'), grouping=1,
00226                 out='int 1%s000 float 1%s000.00 str str' %
00227                 (self.sep, self.sep))
00228 

Here is the call graph for this function:

Definition at line 278 of file test_locale.py.

00278 
00279     def test_currency(self):
00280         self._test_currency(50000, "$50000.00")
00281         self._test_currency(50000, "$50,000.00", grouping=True)
00282         self._test_currency(50000, "USD 50,000.00",
00283             grouping=True, international=True)
00284 

Here is the call graph for this function:

Definition at line 167 of file test_locale.py.

00167 
00168     def test_grouping(self):
00169         self._test_format("%f", 1024, grouping=1, out='1%s024.000000' % self.sep)
00170         self._test_format("%f", 102, grouping=1, out='102.000000')
00171         self._test_format("%f", -42, grouping=1, out='-42.000000')
00172         self._test_format("%+f", -42, grouping=1, out='-42.000000')

Here is the call graph for this function:

Definition at line 173 of file test_locale.py.

00173 
00174     def test_grouping_and_padding(self):
00175         self._test_format("%20.f", -42, grouping=1, out='-42'.rjust(20))
00176         if self.sep:
00177             self._test_format("%+10.f", -4200, grouping=1,
00178                 out=('-4%s200' % self.sep).rjust(10))
00179             self._test_format("%-10.f", -4200, grouping=1,
00180                 out=('-4%s200' % self.sep).ljust(10))

Here is the call graph for this function:

Definition at line 181 of file test_locale.py.

00181 
00182     def test_integer_grouping(self):
00183         self._test_format("%d", 4200, grouping=True, out='4%s200' % self.sep)
00184         self._test_format("%+d", 4200, grouping=True, out='+4%s200' % self.sep)
00185         self._test_format("%+d", -4200, grouping=True, out='-4%s200' % self.sep)

Here is the call graph for this function:

Definition at line 186 of file test_locale.py.

00186 
00187     def test_integer_grouping_and_padding(self):
00188         self._test_format("%10d", 4200, grouping=True,
00189             out=('4%s200' % self.sep).rjust(10))
00190         self._test_format("%-10d", -4200, grouping=True,
00191             out=('-4%s200' % self.sep).ljust(10))

Here is the call graph for this function:

Definition at line 198 of file test_locale.py.

00198 
00199     def test_padding(self):
00200         self._test_format("%20.f", -42, grouping=0, out='-42'.rjust(20))
00201         self._test_format("%+10.f", -4200, grouping=0, out='-4200'.rjust(10))
00202         self._test_format("%-10.f", 4200, grouping=0, out='4200'.ljust(10))

Here is the call graph for this function:

Definition at line 192 of file test_locale.py.

00192 
00193     def test_simple(self):
00194         self._test_format("%f", 1024, grouping=0, out='1024.000000')
00195         self._test_format("%f", 102, grouping=0, out='102.000000')
00196         self._test_format("%f", -42, grouping=0, out='-42.000000')
00197         self._test_format("%+f", -42, grouping=0, out='-42.000000')

Here is the call graph for this function:


Member Data Documentation

Initial value:
{
        'currency_symbol': '$',
        'decimal_point': '.',
        'frac_digits': 2,
        'grouping': [3, 3, 0],
        'int_curr_symbol': 'USD ',
        'int_frac_digits': 2,
        'mon_decimal_point': '.',
        'mon_grouping': [3, 3, 0],
        'mon_thousands_sep': ',',
        'n_cs_precedes': 1,
        'n_sep_by_space': 0,
        'n_sign_posn': 1,
        'negative_sign': '-',
        'p_cs_precedes': 1,
        'p_sep_by_space': 0,
        'p_sign_posn': 1,
        'positive_sign': '',
        'thousands_sep': ','
    }

Definition at line 91 of file test_locale.py.

Definition at line 107 of file object.h.

struct _typeobject* _object::ob_type [inherited]

Definition at line 108 of file object.h.

Definition at line 165 of file test_locale.py.


The documentation for this class was generated from the following file: