def test_scientific_notation_with_parameter(self): assert format_number( '1e10', iScientificNotation=u'%s\u00a0\u00d7\u00a010<sup>%s</sup>') == \ u'1\u00a0\u00d7\u00a010<sup>10</sup>' # u00a0 is unicode for no breaking space, # u00d7 is unicode for times, # the last bit of this string before the sup is actually \u00a0 followed by 10. # Final output of this is assert 1 * 10^10 # but with the appropriate unicode and html in it as well assert format_number('1e10', iScientificNotation=u'%se%s') == u'1e10' assert format_number( '1e-10', iScientificNotation=u'%s\u00a0\u00d7\u00a010<sup>%s</sup>') == \ u'1\u00a0\u00d7\u00a010<sup>\u221210</sup>'
def test_decimal_separator_with_parameter(self): assert format_number('0.0547', decimalSeparator=',') == '0,0547' assert format_number('0.0547', decimalSeparator='.') == '0.0547'
def test_thousandths_separator_with_parameter(self): assert format_number('0.03872432', thousandthsSeparator='') == '0,03872432' assert format_number(u'0.039478987192', thousandthsSeparator=u' ') == '0,039 478 987 192'
def test_minus_symbol_with_parameter(self): assert format_number('-5', minusSymbol=entities.unicode['minus']) == u'\u22125' assert format_number('-5', minusSymbol='-') == u'-5'
def test_thousand_separator(self): assert format_number('1000') == u'1\xa0000' # xa0 is unicode for no breaking space assert format_number('14739') == u'14\xa0739' assert format_number('999') == u'999' assert format_number('+5') == u'+5'
def test_thousand_separator_with_parameter(self): assert format_number('1000', thousandsSeparator='|') == u'1|000'
def test_decimal_separator_with_parameter(self): self.assertEqual(format_number('0.0547', decimalSeparator=','), '0,0547') self.assertEqual(format_number('0.0547', decimalSeparator='.'), '0.0547')
def test_thousandths_separator_with_parameter(self): self.assertEqual(format_number('0.03872432', thousandthsSeparator=''), '0,03872432') self.assertEqual( format_number(u'0.039478987192', thousandthsSeparator=u' '), '0,039 478 987 192')
def test_minus_symbol_with_parameter(self): self.assertEqual(format_number('-5', minusSymbol=entities.unicode['minus']), u'\u22125') self.assertEqual(format_number('-5', minusSymbol='-'), u'-5')
def test_thousand_separator_with_parameter(self): self.assertEqual(format_number('1000', thousandsSeparator='|'), u'1|000')
def test_thousand_separator(self): self.assertEqual(format_number('1000'), u'1\xa0000') # xa0 is unicode for no breaking space self.assertEqual(format_number('14739'), u'14\xa0739') self.assertEqual(format_number('999'), u'999') self.assertEqual(format_number('+5'), u'+5')