

def test_GenericDateField(self):
    error_invalid = ['Enter a valid date.']
    valid = {
        datetime.date(2006, 10, 25): datetime.date(2006, 10, 25),
        datetime.datetime(2006, 10, 25, 14, 30): datetime.date(2006, 10, 25),
        datetime.datetime(2006, 10, 25, 14, 30, 59): datetime.date(2006, 10, 25),
        datetime.datetime(2006, 10, 25, 14, 30, 59, 200): datetime.date(2006, 10, 25),
        '2006-10-25': datetime.date(2006, 10, 25),
        '25/10/2006': datetime.date(2006, 10, 25),
        '25/10/06': datetime.date(2006, 10, 25),
        'Oct 25 2006': datetime.date(2006, 10, 25),
        'October 25 2006': datetime.date(2006, 10, 25),
        'October 25, 2006': datetime.date(2006, 10, 25),
        '25 October 2006': datetime.date(2006, 10, 25),
        '25 October, 2006': datetime.date(2006, 10, 25),
    }
    invalid = {
        '2006-4-31': error_invalid,
        '200a-10-25': error_invalid,
        '10/25/06': error_invalid,
    }
    self.assertFieldOutput(DateField, valid, invalid, empty_value=None)
    valid = {
        datetime.date(2006, 10, 25): datetime.date(2006, 10, 25),
        datetime.datetime(2006, 10, 25, 14, 30): datetime.date(2006, 10, 25),
        '2006 10 25': datetime.date(2006, 10, 25),
    }
    invalid = {
        '2006-10-25': error_invalid,
        '25/10/2006': error_invalid,
        '25/10/06': error_invalid,
    }
    kwargs = {
        'input_formats': ['%Y %m %d'],
    }
    self.assertFieldOutput(DateField, valid, invalid, field_kwargs=kwargs, empty_value=None)

dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-1.4/tests/regressiontests/localflavor/generic/tests.py GenericLocalFlavorTests.test_GenericDateField/original