With recent updates the library now respects and enforces Section.type as a required attribute and allows save only with documents where this requirement is satisfied.
To allow backwards file compatibility and ease usage, Section.type is by default set to the string n.s. (not specified), which means files where no section type had been specified can be loaded and saved, but will contain n.s. as value for all Sections.types that where previously not specified.
Further the validation run before a document can be saved will issue a warning, if a Section.type with value n.s. is encountered and will still refuse to save with an error, if an empty Section.type is encountered.
Further changes in this PR:
the base.Sectionable.create_section method has been updated to conform with Section.__init__. This should close issue #368
Validation messages to increase clarity for the user
Tests corresponding to the Section.type and validations in general have been updated to adhere to and reflect the changes and refactored to reduce redundancy in general.
Coverage decreased (-0.009%) to 76.32% when pulling 04d09197da74b67979eadabe09ca04f3c8170d90 on mpsonntag:handleSectionType into 4fcfcc9dc41c3ca9e2bd9d8321af5a9f38368e50 on G-Node:master.
With recent updates the library now respects and enforces
Section.type
as a required attribute and allows save only with documents where this requirement is satisfied. To allow backwards file compatibility and ease usage,Section.type
is by default set to the stringn.s.
(not specified), which means files where no section type had been specified can be loaded and saved, but will containn.s.
as value for allSections.types
that where previously not specified. Further the validation run before a document can be saved will issue a warning, if aSection.type
with valuen.s.
is encountered and will still refuse to save with an error, if an emptySection.type
is encountered.Further changes in this PR:
base.Sectionable.create_section
method has been updated to conform withSection.__init__
. This should close issue #368Section.type
and validations in general have been updated to adhere to and reflect the changes and refactored to reduce redundancy in general.