File tree Expand file tree Collapse file tree 3 files changed +29
-14
lines changed
testdata/test_model/parse Expand file tree Collapse file tree 3 files changed +29
-14
lines changed Original file line number Diff line number Diff line change @@ -795,21 +795,8 @@ def __eq__(self, other):
795795 def all_fields (self ):
796796 """
797797 Return the list of all Field objects.
798- If with_absent, include absent (not present) fields.
799- If with_empty, include empty fields.
800798 """
801- all_fields = []
802-
803- for field in list (self .fields .values ()) + list (self .custom_fields .values ()):
804- if field .required :
805- all_fields .append (field )
806- else :
807- if field .present :
808- if field .value :
809- all_fields .append (field )
810- elif field .name in boolean_fields and not field .value == None :
811- all_fields .append (field )
812- return all_fields
799+ return list (self .fields .values ()) + list (self .custom_fields .values ())
813800
814801 def as_dict (self ):
815802 """
Original file line number Diff line number Diff line change @@ -578,6 +578,27 @@ def test_About_invalid_boolean_value(self):
578578 expected_msg = "Field modified: Invalid flag value: 'blah'"
579579 assert expected_msg in a .errors [0 ].message
580580
581+ def test_About_boolean_value (self ):
582+ test_file = get_test_loc ('test_model/parse/boolean_data.about' )
583+ a = model .About (test_file )
584+ expected_msg = "Field track_changes is present but empty."
585+ assert expected_msg in a .errors [0 ].message
586+ # Context of the test file
587+ """
588+ about_resource: .
589+ name: boolean_data
590+ attribute: False
591+ modified: true
592+ internal_use_only: no
593+ redistribute: yes
594+ track_changes:
595+ """
596+ assert a .attribute .value is False
597+ assert a .modified .value is True
598+ assert a .internal_use_only .value is False
599+ assert a .redistribute .value is True
600+ assert a .track_changes .value is None
601+
581602 def test_About_contains_about_file_path (self ):
582603 test_file = get_test_loc ('test_model/serialize/about.ABOUT' )
583604 # TODO: I am not sure this override of the about_file_path makes sense
Original file line number Diff line number Diff line change 1+ about_resource: .
2+ name: boolean_data
3+ attribute: False
4+ modified: true
5+ internal_use_only: no
6+ redistribute: yes
7+ track_changes:
You can’t perform that action at this time.
0 commit comments