'Tests if form input is correctly localized'

def test_localized_input(self):

    settings.USE_L10N = True
    activate('de-at')
    try:
        form6 = CompanyForm({'name': u'acme', 'date_added': datetime.datetime(2009, 12, 31, 6, 0, 0), 'cents_payed': decimal.Decimal('59.47'), 'products_delivered': 12000})
        self.assertEqual(True, form6.is_valid())
        self.assertEqual(form6.as_ul(), u'<li><label    for="id_name">Name:</label>    <input    id="id_name"    type="text"    name="name"    value="acme"    maxlength="50"    /></li>\n<li><label    for="id_date_added">Date    added:</label>    <input    type="text"    name="date_added"    value="31.12.2009    06:00:00"    id="id_date_added"    /></li>\n<li><label    for="id_cents_payed">Cents    payed:</label>    <input    type="text"    name="cents_payed"    value="59,47"    id="id_cents_payed"    /></li>\n<li><label    for="id_products_delivered">Products    delivered:</label>    <input    type="text"    name="products_delivered"    value="12000"    id="id_products_delivered"    /></li>')
        self.assertEqual(localize_input(datetime.datetime(2009, 12, 31, 6, 0, 0)), '31.12.2009    06:00:00')
        self.assertEqual(datetime.datetime(2009, 12, 31, 6, 0, 0), form6.cleaned_data['date_added'])
        settings.USE_THOUSAND_SEPARATOR = True
        self.assert_((u'<input    type="text"    name="products_delivered"    value="12.000"    id="id_products_delivered"    />' in form6.as_ul()))
    finally:
        deactivate()
