easysettings icon indicating copy to clipboard operation
easysettings copied to clipboard

Allow `set` and `save` to be chained

Open aitorres opened this issue 3 years ago • 0 comments

Resolves #11

What I did

  • [x] 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()
  • [x] Added a new test case to ensure that set().save() works as expected
  • [x] Also, I added a new test case to the base settings tests to make the same check for setsave()
  • [x] 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

aitorres avatar Dec 15 '21 14:12 aitorres