File tree Expand file tree Collapse file tree 2 files changed +18
-4
lines changed
Expand file tree Collapse file tree 2 files changed +18
-4
lines changed Original file line number Diff line number Diff line change @@ -56,9 +56,6 @@ def __len__(self):
5656 if isinstance (val , Container ):
5757 if val .is_unset ():
5858 continue
59- elif isinstance (val , ValueList ):
60- if len (val ) == 0 :
61- continue
6259 elif val is None :
6360 continue
6461 retval = i + 1
@@ -161,7 +158,7 @@ def _check_value_length(self, value):
161158 def render (self , value ):
162159 if value is None :
163160 return ""
164-
161+
165162 return self ._render_value (value )
166163
167164class TypedField (Field , SubclassesMixin ):
Original file line number Diff line number Diff line change @@ -298,6 +298,23 @@ def test_sequence_repr():
298298
299299 assert repr (s ) == 'SegmentSequence([])'
300300
301+ def test_valuelist_repr ():
302+ class A (Container ):
303+ a = NumericField (max_count = 3 )
304+
305+ i1 = A ()
306+ assert repr (i1 .a ) == "[]"
307+
308+ def test_empty_list ():
309+ class A (Container ):
310+ a = NumericField (max_count = 3 )
311+
312+ i1 = A ()
313+ assert len (i1 .a ) == 0
314+
315+ i2 = A (a = [None ])
316+ assert len (i2 .a ) == 0
317+
301318def test_segmentheader_short ():
302319 h = SegmentHeader ('HNHBS' , 5 , 1 )
303320
You can’t perform that action at this time.
0 commit comments