Skip to content

Allow set and save to be chained#15

Open
aitorres wants to merge 2 commits into
welbornprod:devfrom
aitorres:feature/set-save-chain
Open

Allow set and save to be chained#15
aitorres wants to merge 2 commits into
welbornprod:devfrom
aitorres:feature/set-save-chain

Conversation

@aitorres
Copy link
Copy Markdown

@aitorres aitorres commented Dec 15, 2021

Resolves #11

What I did

  • Modified the settings base class to return self on both set() and save(), allowing these two methods to be chained as an alternative to setsave()
  • Added a new test case to ensure that set().save() works as expected
  • Also, I added a new test case to the base settings tests to make the same check for setsave()
  • Fixed setsave() calls in YAMLSettings and TOMLSettings, as well as in JSONSettings, since they weren't passing the option and value arguments to the super call. This was uncovered after adding the test for setsave mentioned above.

At this point I haven't removed the setsave method (in case it should remain for compatibility reasons), and I haven't (yet) made any changes to the README, changelog or docs, but I could do if needed!

How to test

I added two new tests to test_settingsbase, all tests should pass with pytest

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow .set(), and .save() to be chainable.

1 participant