##// END OF EJS Templates
Test for Union Traitlet
Sylvain Corlay -
Show More
@@ -18,7 +18,7 b' from nose import SkipTest'
18 from IPython.utils.traitlets import (
18 from IPython.utils.traitlets import (
19 HasTraits, MetaHasTraits, TraitType, Any, CBytes, Dict,
19 HasTraits, MetaHasTraits, TraitType, Any, CBytes, Dict,
20 Int, Long, Integer, Float, Complex, Bytes, Unicode, TraitError,
20 Int, Long, Integer, Float, Complex, Bytes, Unicode, TraitError,
21 Undefined, Type, This, Instance, TCPAddress, List, Tuple,
21 Union, Undefined, Type, This, Instance, TCPAddress, List, Tuple,
22 ObjectName, DottedObjectName, CRegExp, link, directional_link,
22 ObjectName, DottedObjectName, CRegExp, link, directional_link,
23 EventfulList, EventfulDict, ForwardDeclaredType, ForwardDeclaredInstance,
23 EventfulList, EventfulDict, ForwardDeclaredType, ForwardDeclaredInstance,
24 )
24 )
@@ -760,6 +760,16 b' class AnyTraitTest(TraitTestBase):'
760 _good_values = [10.0, 'ten', u'ten', [10], {'ten': 10},(10,), None, 1j]
760 _good_values = [10.0, 'ten', u'ten', [10], {'ten': 10},(10,), None, 1j]
761 _bad_values = []
761 _bad_values = []
762
762
763 class UnionTrait(HasTraits):
764
765 value = Union([Type(), Unicode()])
766
767 class UnionTraitTest(TraitTestBase):
768
769 obj = UnionTrait()
770 _default_value = None
771 _good_values = [int, float, 'ten']
772 _bad_values = [[], (0,), 1j]
763
773
764 class IntTrait(HasTraits):
774 class IntTrait(HasTraits):
765
775
General Comments 0
You need to be logged in to leave comments. Login now