Converted Irish localflavor doctests to unittests. We have always been at war with doctests. Thanks to Idan Gazit.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@14942 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Alex Gaynor 2010-12-18 20:31:10 +00:00
parent 55c81c36e6
commit b5ac6956a6
3 changed files with 42 additions and 11 deletions

View File

@ -1,12 +1,43 @@
# -*- coding: utf-8 -*- from django.contrib.localflavor.ie.forms import IECountySelect
# Tests for the contrib/localflavor/ie form fields.
tests = r""" from utils import LocalFlavorTestCase
# IECountySelect #########################################################
>>> from django.contrib.localflavor.ie.forms import IECountySelect
>>> f = IECountySelect()
>>> f.render('counties', 'dublin')
u'<select name="counties">\n<option value="antrim">Antrim</option>\n<option value="armagh">Armagh</option>\n<option value="carlow">Carlow</option>\n<option value="cavan">Cavan</option>\n<option value="clare">Clare</option>\n<option value="cork">Cork</option>\n<option value="derry">Derry</option>\n<option value="donegal">Donegal</option>\n<option value="down">Down</option>\n<option value="dublin" selected="selected">Dublin</option>\n<option value="fermanagh">Fermanagh</option>\n<option value="galway">Galway</option>\n<option value="kerry">Kerry</option>\n<option value="kildare">Kildare</option>\n<option value="kilkenny">Kilkenny</option>\n<option value="laois">Laois</option>\n<option value="leitrim">Leitrim</option>\n<option value="limerick">Limerick</option>\n<option value="longford">Longford</option>\n<option value="louth">Louth</option>\n<option value="mayo">Mayo</option>\n<option value="meath">Meath</option>\n<option value="monaghan">Monaghan</option>\n<option value="offaly">Offaly</option>\n<option value="roscommon">Roscommon</option>\n<option value="sligo">Sligo</option>\n<option value="tipperary">Tipperary</option>\n<option value="tyrone">Tyrone</option>\n<option value="waterford">Waterford</option>\n<option value="westmeath">Westmeath</option>\n<option value="wexford">Wexford</option>\n<option value="wicklow">Wicklow</option>\n</select>'
""" class IELocalFlavorTests(LocalFlavorTestCase):
def test_IECountySelect(self):
f = IECountySelect()
out = u'''<select name="counties">
<option value="antrim">Antrim</option>
<option value="armagh">Armagh</option>
<option value="carlow">Carlow</option>
<option value="cavan">Cavan</option>
<option value="clare">Clare</option>
<option value="cork">Cork</option>
<option value="derry">Derry</option>
<option value="donegal">Donegal</option>
<option value="down">Down</option>
<option value="dublin" selected="selected">Dublin</option>
<option value="fermanagh">Fermanagh</option>
<option value="galway">Galway</option>
<option value="kerry">Kerry</option>
<option value="kildare">Kildare</option>
<option value="kilkenny">Kilkenny</option>
<option value="laois">Laois</option>
<option value="leitrim">Leitrim</option>
<option value="limerick">Limerick</option>
<option value="longford">Longford</option>
<option value="louth">Louth</option>
<option value="mayo">Mayo</option>
<option value="meath">Meath</option>
<option value="monaghan">Monaghan</option>
<option value="offaly">Offaly</option>
<option value="roscommon">Roscommon</option>
<option value="sligo">Sligo</option>
<option value="tipperary">Tipperary</option>
<option value="tyrone">Tyrone</option>
<option value="waterford">Waterford</option>
<option value="westmeath">Westmeath</option>
<option value="wexford">Wexford</option>
<option value="wicklow">Wicklow</option>
</select>'''
self.assertEqual(f.render('counties', 'dublin'), out)

View File

@ -1,6 +1,5 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from localflavor.cz import tests as localflavor_cz_tests from localflavor.cz import tests as localflavor_cz_tests
from localflavor.ie import tests as localflavor_ie_tests
from localflavor.is_ import tests as localflavor_is_tests from localflavor.is_ import tests as localflavor_is_tests
from localflavor.it import tests as localflavor_it_tests from localflavor.it import tests as localflavor_it_tests
from localflavor.jp import tests as localflavor_jp_tests from localflavor.jp import tests as localflavor_jp_tests
@ -30,13 +29,13 @@ from localflavor.fi import FILocalFlavorTests
from localflavor.fr import FRLocalFlavorTests from localflavor.fr import FRLocalFlavorTests
from localflavor.generic import GenericLocalFlavorTests from localflavor.generic import GenericLocalFlavorTests
from localflavor.id import IDLocalFlavorTests from localflavor.id import IDLocalFlavorTests
from localflavor.ie import IELocalFlavorTests
from localflavor.il import ILLocalFlavorTests from localflavor.il import ILLocalFlavorTests
from localflavor.tr import TRLocalFlavorTests from localflavor.tr import TRLocalFlavorTests
__test__ = { __test__ = {
'localflavor_cz_tests': localflavor_cz_tests, 'localflavor_cz_tests': localflavor_cz_tests,
'localflavor_ie_tests': localflavor_ie_tests,
'localflavor_is_tests': localflavor_is_tests, 'localflavor_is_tests': localflavor_is_tests,
'localflavor_it_tests': localflavor_it_tests, 'localflavor_it_tests': localflavor_it_tests,
'localflavor_jp_tests': localflavor_jp_tests, 'localflavor_jp_tests': localflavor_jp_tests,

View File

@ -27,6 +27,7 @@ from regressiontests.forms.localflavortests import (
FRLocalFlavorTests, FRLocalFlavorTests,
GenericLocalFlavorTests, GenericLocalFlavorTests,
IDLocalFlavorTests, IDLocalFlavorTests,
IELocalFlavorTests,
ILLocalFlavorTests, ILLocalFlavorTests,
TRLocalFlavorTests, TRLocalFlavorTests,
) )