Refine code.
authorHuang Peng <shawn.p.huang@gmail.com>
Tue, 19 Aug 2008 01:23:37 +0000 (09:23 +0800)
committerHuang Peng <shawn.p.huang@gmail.com>
Tue, 19 Aug 2008 01:23:37 +0000 (09:23 +0800)
ibus/property.py

index 5a952e7d1d8e7c3270c556e7d55807a4272e5df9..da769ce47c9c2f263a53f65c43d3a404f9dca2dd 100644 (file)
@@ -51,6 +51,7 @@ def _to_unicode(text):
         return text
     if isinstance(text, str):
         return unicode(text, "utf8")
+    raise TypeError("text must be instance of unicode or str")
 
 class Property(object):
     def __init__(self, name,
@@ -238,6 +239,9 @@ def test():
     props.append(p)
     value = props.to_dbus_value()
     print prop_list_from_dbus_value(value)
+    p.label = u"a"
+    p.label = "a"
+    p.label = 1
 
 if __name__ == "__main__":
     test()