Skip to content

Commit c133a7e

Browse files
committed
add a test for unicode tags and TaggedItems
1 parent 12ebcac commit c133a7e

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

tagging/tests/tests.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,9 @@
1010
from tagging import settings
1111
from tagging.forms import TagField
1212
from tagging.models import Tag, TaggedItem
13-
from tagging.tests.models import Article, Link, Perch, Parrot, FormTest
14-
from tagging.utils import calculate_cloud, edit_string_for_tags, get_tag_list, get_tag, parse_tag_input
13+
from tagging.tests.models import Article, Link, Perch, Parrot, FormTest, FormTestNull
14+
from tagging.utils import (calculate_cloud, edit_string_for_tags, get_tag_list,
15+
get_tag, parse_tag_input)
1516
from tagging.utils import LINEAR
1617

1718

@@ -326,6 +327,14 @@ def test_update_tags_exotic_characters(self):
326327
self.assertEqual(len(tags), 1)
327328
self.assertEqual(tags[0].name, '你好')
328329

330+
def test_unicode_tagged_object(self):
331+
self.dead_parrot.state = u"dëad"
332+
self.dead_parrot.save()
333+
Tag.objects.update_tags(self.dead_parrot, u'föo')
334+
items = TaggedItem.objects.all()
335+
self.assertEqual(len(items), 1)
336+
self.assertEqual(unicode(items[0]), u"dëad [föo]")
337+
329338
def test_update_tags_with_none(self):
330339
# start off in a known, mildly interesting state
331340
Tag.objects.update_tags(self.dead_parrot, 'foo bar baz')

0 commit comments

Comments
 (0)