@@ -12,7 +12,7 @@ class ChannelTest(unittest.TestCase):
1212 link_name : str
1313
1414 def test_no_args_given (self ):
15- with pytest .raises (ValueError , match = "value for 'id' must be given and must not be empty " ):
15+ with pytest .raises (ValueError , match = "value for 'id' must be given" ):
1616 obj = self .channel_cls ()
1717
1818 def test_id_given (self ):
@@ -29,14 +29,14 @@ def test_app_ok(self):
2929
3030 def test_container_with_id (self ):
3131 with pytest .raises (
32- TypeError ,
33- match = "value of 'id ' must be None, but was 'test_id' " ,
32+ ValueError ,
33+ match = "value for 'property ' must be given " ,
3434 ):
3535 self .channel_cls ("test_id" , ** {self .link_name : "container" })
3636
3737 def test_app_no_prop (self ):
3838 with pytest .raises (
39- TypeError ,
39+ ValueError ,
4040 match = "value for 'property' must be given" ,
4141 ):
4242 self .channel_cls (** {self .link_name : "app" })
@@ -45,15 +45,14 @@ def test_wrong_link(self):
4545 with pytest .raises (
4646 ValueError ,
4747 match = (
48- f"value of '{ self .link_name } ' must be one of"
49- f" \\ ('component', 'container', 'app', None\\ ),"
50- f" but was 'host'"
48+ f"value of { self .link_name !r} must be one of"
49+ r" \('container', 'app'\), but was 'host'"
5150 ),
5251 ):
5352 self .channel_cls (** {self .link_name : "host" })
5453
5554 def test_no_trigger (self ):
56- obj = self .channel_cls ()
55+ obj = self .channel_cls ("some_id" )
5756 if isinstance (obj , State ):
5857 self .assertTrue (obj .no_trigger )
5958 else :
@@ -88,6 +87,10 @@ class InputTest(make_base(), unittest.TestCase):
8887 channel_cls = Input
8988 link_name = "source"
9089
90+ def test_disallow_empty_property (self ):
91+ with pytest .raises (ValueError , match = "value for 'property' must be given" ):
92+ self .channel_cls ("some_id" , "" )
93+
9194
9295class StateTest (make_base (), unittest .TestCase ):
9396 channel_cls = State
@@ -97,3 +100,9 @@ class StateTest(make_base(), unittest.TestCase):
97100class OutputTest (make_base (), unittest .TestCase ):
98101 channel_cls = Output
99102 link_name = "target"
103+
104+ def test_allow_empty_property (self ):
105+ obj = self .channel_cls ("some_id" , "" )
106+ self .assertEqual ("component" , obj .link )
107+ self .assertEqual ("some_id" , obj .id )
108+ self .assertEqual ("" , obj .property )
0 commit comments