Back to index

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

List of all members.

Public Member Functions

def setUp
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

Detailed Description

Definition at line 160 of file test_locale.py.


Member Function Documentation

Reimplemented in test.test_locale.TestEnUSNumberFormatting, and test.test_locale.TestNumberFormatting.

Definition at line 164 of file test_locale.py.

00164 
00165     def setUp(self):
00166         self.sep = locale.localeconv()['thousands_sep']

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 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

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: