@@ -49,8 +49,8 @@ def clear_records():
4949 _clear_records ()
5050
5151
52- def record_funcs_names (fixture_value ):
53- """Provide a nice name for the record_funcs fixture"""
52+ def record_func_names (fixture_value ):
53+ """Provide a nice name for the record_func fixture"""
5454 return fixture_value .__name__
5555
5656
@@ -72,21 +72,12 @@ def record_funcs_names(fixture_value):
7272 builder .longStringIn ,
7373 builder .longStringOut ,
7474 ],
75- ids = record_funcs_names ,
75+ ids = record_func_names ,
7676)
77- def record_funcs (request ):
77+ def record_func (request ):
7878 """The list of record creation functions"""
7979 return request .param
8080
81-
82- @pytest .fixture
83- def record_funcs_reject_none (record_funcs ):
84- """The list of record creation functions that reject 'None' as a value"""
85- if record_funcs in [builder .stringIn , builder .stringOut ]:
86- pytest .skip (msg = "None is valid value for string records" )
87- return record_funcs
88-
89-
9081def record_values_names (fixture_value ):
9182 """Provide a nice name for the tests in the record_values fixture"""
9283 return (
@@ -111,8 +102,6 @@ def record_values_names(fixture_value):
111102 ("aOut_nan" , builder .aOut , nan , nan , float ),
112103 ("longIn_int" , builder .longIn , 5 , 5 , int ),
113104 ("longOut_int" , builder .longOut , 5 , 5 , int ),
114- ("longIn_float" , builder .longIn , 9.9 , 9 , int ),
115- ("longOut_float" , builder .longOut , 9.9 , 9 , int ),
116105 ("boolIn_int" , builder .boolIn , 1 , 1 , int ),
117106 ("boolOut_int" , builder .boolOut , 1 , 1 , int ),
118107 ("boolIn_true" , builder .boolIn , True , 1 , int ),
@@ -128,32 +117,8 @@ def record_values_names(fixture_value):
128117 ("strOut_abc" , builder .stringOut , "abc" , "abc" , str ),
129118 ("strIn_empty" , builder .stringIn , "" , "" , str ),
130119 ("strOut_empty" , builder .stringOut , "" , "" , str ),
131- ("strIn_bytes" , builder .stringIn , b"abc" , "abc" , str ),
132- ("strOut_bytes" , builder .stringOut , b"abc" , "abc" , str ),
133- ("strin_utf8" , builder .stringIn , "a€b" , "a€b" , str ), # Valid UTF-8
134- ("strOut_utf8" , builder .stringOut , "a€b" , "a€b" , str ), # Valid UTF-8
135- ("strIn_badutf8" , builder .stringIn , b"a\xcf b" , "a�b" , str ), # Invalid UTF-8
136- (
137- "strOut_badutf8" ,
138- builder .stringOut ,
139- b"a\xcf b" , # Invalid UTF-8
140- "a�b" ,
141- str ,
142- ),
143- (
144- "strIn_byteutf8" ,
145- builder .stringIn ,
146- b"a\xe2 \x82 \xac b" , # Valid UTF-8
147- "a€b" ,
148- str ,
149- ),
150- (
151- "strOut_byteutf8" ,
152- builder .stringOut ,
153- b"a\xe2 \x82 \xac b" , # Valid UTF-8
154- "a€b" ,
155- str ,
156- ),
120+ ("strin_utf8" , builder .stringIn , "%a€b" , "%a€b" , str ), # Valid UTF-8
121+ ("strOut_utf8" , builder .stringOut , "%a€b" , "%a€b" , str ), # Valid UTF-8
157122 (
158123 "strIn_longstr" ,
159124 builder .stringIn ,
@@ -866,34 +831,31 @@ class TestNoneValue:
866831 expected_exceptions = (ValueError , TypeError , AttributeError )
867832
868833 def test_value_none_rejected_initial_value (
869- self , clear_records , record_funcs_reject_none
834+ self , clear_records , record_func
870835 ):
871836 """Test setting \" None\" as the initial_value raises an exception"""
872837
873838 kwarg = {}
874- if record_funcs_reject_none in [
839+ if record_func in [
875840 builder .WaveformIn ,
876841 builder .WaveformOut ,
877842 ]:
878843 kwarg = {"length" : 50 } # Required when no value on creation
879844
880845 with pytest .raises (self .expected_exceptions ):
881- record_funcs_reject_none ("SOME-NAME" , initial_value = None , ** kwarg )
846+ record_func ("SOME-NAME" , initial_value = None , ** kwarg )
882847
883848 def test_value_none_rejected_set_before_init (
884- self , clear_records , record_funcs_reject_none
849+ self , clear_records , record_func
885850 ):
886851 """Test that setting \" None\" using .set() raises an exception"""
887852
888853 kwarg = {}
889- if record_funcs_reject_none in [
890- builder .WaveformIn ,
891- builder .WaveformOut ,
892- ]:
854+ if record_func in [builder .WaveformIn , builder .WaveformOut ]:
893855 kwarg = {"length" : 50 } # Required when no value on creation
894856
895857 with pytest .raises (self .expected_exceptions ):
896- record = record_funcs_reject_none ("SOME-NAME" , ** kwarg )
858+ record = record_func ("SOME-NAME" , ** kwarg )
897859 record .set (None )
898860
899861 def none_value_test_func (self , record_func , queue ):
@@ -915,13 +877,13 @@ def none_value_test_func(self, record_func, queue):
915877 queue .put (Exception ("FAIL:Test did not raise exception during .set()" ))
916878
917879 @requires_cothread
918- def test_value_none_rejected_set_after_init (self , record_funcs_reject_none ):
880+ def test_value_none_rejected_set_after_init (self , record_func ):
919881 """Test that setting \" None\" using .set() after IOC init raises an
920882 exception"""
921883 queue = multiprocessing .Queue ()
922884 process = multiprocessing .Process (
923885 target = self .none_value_test_func ,
924- args = (record_funcs_reject_none , queue ),
886+ args = (record_func , queue ),
925887 )
926888
927889 process .start ()
0 commit comments