brocksam / pyproprop

Write classes with lots of similar simple defensive properties without the boilerplate
MIT License
3 stars 1 forks source link

Make string formatting compatible with options #41

Closed jackirvine97 closed 4 years ago

jackirvine97 commented 4 years ago

I would like to be able to format a string before checking if it is one of a set of options:

prop = processed_property(
        "prop_name",
        str_format="hyphen",
        options=OPTIONS_DISPATCHER.keys(),
)

This would involve simply reordering conditionals in the processed property setter method so that the string formatting comes before option checking.

I am happy to implement, but first want to check this potential refactor is compatible with other pyproprop use cases?

brocksam commented 4 years ago

See #40. We can likely combine.

brocksam commented 4 years ago

Please see tests/unit/processed_property/test_option.py::test_setting_with_valid_options in PR #42.

brocksam commented 4 years ago

Addressed in c82e595c7762c73ae551819ba74f8f6af5d892c6.