Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Converted Irish localflavor doctests to unittests. We have always bee…

…n at war with doctests. Thanks to Idan Gazit.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@14942 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit b5ac6956a626e9a057628e6205547d070ca03f02 1 parent 55c81c3
Alex Gaynor authored December 18, 2010
49  tests/regressiontests/forms/localflavor/ie.py
... ...
@@ -1,12 +1,43 @@
1  
-# -*- coding: utf-8 -*-
2  
-# Tests for the contrib/localflavor/ie form fields.
  1
+from django.contrib.localflavor.ie.forms import IECountySelect
3 2
 
4  
-tests = r"""
5  
-# IECountySelect #########################################################
  3
+from utils import LocalFlavorTestCase
6 4
 
7  
->>> from django.contrib.localflavor.ie.forms import IECountySelect
8  
->>> f = IECountySelect()
9  
->>> f.render('counties', 'dublin')
10  
-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>'
11 5
 
12  
-"""
  6
+class IELocalFlavorTests(LocalFlavorTestCase):
  7
+    def test_IECountySelect(self):
  8
+        f = IECountySelect()
  9
+        out = u'''<select name="counties">
  10
+<option value="antrim">Antrim</option>
  11
+<option value="armagh">Armagh</option>
  12
+<option value="carlow">Carlow</option>
  13
+<option value="cavan">Cavan</option>
  14
+<option value="clare">Clare</option>
  15
+<option value="cork">Cork</option>
  16
+<option value="derry">Derry</option>
  17
+<option value="donegal">Donegal</option>
  18
+<option value="down">Down</option>
  19
+<option value="dublin" selected="selected">Dublin</option>
  20
+<option value="fermanagh">Fermanagh</option>
  21
+<option value="galway">Galway</option>
  22
+<option value="kerry">Kerry</option>
  23
+<option value="kildare">Kildare</option>
  24
+<option value="kilkenny">Kilkenny</option>
  25
+<option value="laois">Laois</option>
  26
+<option value="leitrim">Leitrim</option>
  27
+<option value="limerick">Limerick</option>
  28
+<option value="longford">Longford</option>
  29
+<option value="louth">Louth</option>
  30
+<option value="mayo">Mayo</option>
  31
+<option value="meath">Meath</option>
  32
+<option value="monaghan">Monaghan</option>
  33
+<option value="offaly">Offaly</option>
  34
+<option value="roscommon">Roscommon</option>
  35
+<option value="sligo">Sligo</option>
  36
+<option value="tipperary">Tipperary</option>
  37
+<option value="tyrone">Tyrone</option>
  38
+<option value="waterford">Waterford</option>
  39
+<option value="westmeath">Westmeath</option>
  40
+<option value="wexford">Wexford</option>
  41
+<option value="wicklow">Wicklow</option>
  42
+</select>'''
  43
+        self.assertEqual(f.render('counties', 'dublin'), out)
3  tests/regressiontests/forms/localflavortests.py
... ...
@@ -1,6 +1,5 @@
1 1
 # -*- coding: utf-8 -*-
2 2
 from localflavor.cz import tests as localflavor_cz_tests
3  
-from localflavor.ie import tests as localflavor_ie_tests
4 3
 from localflavor.is_ import tests as localflavor_is_tests
5 4
 from localflavor.it import tests as localflavor_it_tests
6 5
 from localflavor.jp import tests as localflavor_jp_tests
@@ -30,13 +29,13 @@
30 29
 from localflavor.fr import FRLocalFlavorTests
31 30
 from localflavor.generic import GenericLocalFlavorTests
32 31
 from localflavor.id import IDLocalFlavorTests
  32
+from localflavor.ie import IELocalFlavorTests
33 33
 from localflavor.il import ILLocalFlavorTests
34 34
 from localflavor.tr import TRLocalFlavorTests
35 35
 
36 36
 
37 37
 __test__ = {
38 38
     'localflavor_cz_tests': localflavor_cz_tests,
39  
-    'localflavor_ie_tests': localflavor_ie_tests,
40 39
     'localflavor_is_tests': localflavor_is_tests,
41 40
     'localflavor_it_tests': localflavor_it_tests,
42 41
     'localflavor_jp_tests': localflavor_jp_tests,
1  tests/regressiontests/forms/tests/__init__.py
@@ -27,6 +27,7 @@
27 27
     FRLocalFlavorTests,
28 28
     GenericLocalFlavorTests,
29 29
     IDLocalFlavorTests,
  30
+    IELocalFlavorTests,
30 31
     ILLocalFlavorTests,
31 32
     TRLocalFlavorTests,
32 33
 )

0 notes on commit b5ac695

Please sign in to comment.
Something went wrong with that request. Please try again.