Skip to content

Re-evaluate Strategies Singleton vs. functions with xml_parsable: bool flag #13

@lu-pl

Description

@lu-pl

The basic problem is that XML 1.0 needs an adapted text strategy because hypothesis.strategies.text() produces non-XML parsable strings.

lodkit.testing_tools.strategies is currently implemented using a Singleton approach defining a singleton using hypothesis.strategies.text() as a literal strategy and another singleton using an XML parsable text strategy for literals.

The singleton approach is kind of awkward because it introduces a class of properties for configuring a single parameter (xml_parsable: bool) which only affects literal strategies, namely triple_literals_plain, triple_literals_lang_tagged, triple_literals_xsd_typed.

Another option would be to have all lodkit strategies defined globally and move the xml_parsable: bool to the affected strategies, i.e. literal strategies and any strategy using a literal strategy...

Strategies requiring an xml_parsable_literals: bool flag would be:

  • literal strategies

    • triple_literals_plain
    • triple_literals_lang_typed
    • triple_literals_xsd_typed
    • triple_literals
  • triple strategies

    • triple_objects
    • triples

This is related to #10. Obviously, if testing support for XML serialization and parsing was dropped, this wouldn't be an issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions