updated some docstrings, fixed issue #16, added some tests for i18n support
[django-tables2.git] / tests / columns.py
index 8dd7cb618d86f79b2c2375a67cca350162a33e0a..8767be9168f754c21effa2dbee0899c4edfe77dd 100644 (file)
@@ -8,10 +8,13 @@ from django.core.exceptions import ImproperlyConfigured
 import django_tables2 as tables
 from django_tables2 import utils, A
 from .testapp.models import Person
+from django.utils.translation import ugettext_lazy
+from django.utils.translation import ugettext
 
 
 general = Tests()
 
+
 @general.test
 def sortable():
     class SimpleTable(tables.Table):
@@ -33,6 +36,21 @@ def sortable():
     Assert(SimpleTable([]).columns['name'].sortable) is True
 
 
+@general.test
+def translation():
+    """
+    Tests different types of values for the ``verbose_name`` property of a
+    column.
+    """
+    class TranslationTable(tables.Table):
+        normal = tables.Column(verbose_name=ugettext("Normal"))
+        lazy = tables.Column(verbose_name=ugettext("Lazy"))
+
+    table = TranslationTable([])
+    Assert("Normal") == table.columns["normal"].header
+    Assert("Lazy") == table.columns["lazy"].header
+
+
 @general.test
 def sequence():
     """