'Localization of numbers'

def test_locale_independent(self):

    with self.settings(USE_THOUSAND_SEPARATOR=False):
        self.assertEqual(u'66666.66', nformat(self.n, decimal_sep=u'.', decimal_pos=2, grouping=3, thousand_sep=u','))
        self.assertEqual(u'66666A6', nformat(self.n, decimal_sep=u'A', decimal_pos=1, grouping=1, thousand_sep=u'B'))
        self.assertEqual(u'66666', nformat(self.n, decimal_sep=u'X', decimal_pos=0, grouping=1, thousand_sep=u'Y'))
    with self.settings(USE_THOUSAND_SEPARATOR=True):
        self.assertEqual(u'66,666.66', nformat(self.n, decimal_sep=u'.', decimal_pos=2, grouping=3, thousand_sep=u','))
        self.assertEqual(u'6B6B6B6B6A6', nformat(self.n, decimal_sep=u'A', decimal_pos=1, grouping=1, thousand_sep=u'B'))
        self.assertEqual(u'-66666.6', nformat((-66666.666), decimal_sep=u'.', decimal_pos=1))
        self.assertEqual(u'-66666.0', nformat(int(u'-66666'), decimal_sep=u'.', decimal_pos=1))
        self.assertEqual(u'10000.0', nformat(self.l, decimal_sep=u'.', decimal_pos=1))
        self.assertEqual(u'10000', nformat(self.l, decimal_sep=u'.', decimal_pos=0, grouping=0, force_grouping=True))
        self.assertEqual(u'31.12.2009    \u0432    20:50', Template(u'{{    dt|date:"d.m.Y    \u0432    H:i"    }}').render(self.ctxt))
        self.assertEqual(u'\u231a    10:15', Template(u'{{    t|time:"\u231a    H:i"    }}').render(self.ctxt))
