Changed period into abstract class and moved docstrings
Already passed the pre-commit test. Not sure why the build failed
Did you have a look at the build log? You can do so by clicking 'Details'.
Did you have a look at the build log? You can do so by clicking 'Details'.
TypeError: Can't instantiate abstract class Period with abstract methods add_entry, get_entries, get_entry, remove_entry, update_entry
def test_default_name(self):
period = Period()
year = dt.date.today().year
self.assertEqual(period.year, year)
self.assertEqual(period.name, str(year))
I'm not sure how to test an abstract class. Should I delete this function?
Ah that's tricky. Have a look at this (I found it by googling for 'python test abstract class method'). This means you could do
Period.__abstractmethods__ = set()
period = Period()
Coverage increased (+0.004%) to 99.577% when pulling c7cea258df90c7bd4007f5becdca13a0b6ecf7d7 on cardinalion:period-new into 50aed57980d48ffbbb4813cdc9c45e9efdb2ae50 on pylipp:master.
Can you rebase this onto master?
Can you also move the methods _preprocess_entry, _remove_redundant_fields, _validate_entry, and _substitute_none_fields and _convert_fields to Period? (sorry for blowing this up so much :))
Can you also move the methods
_preprocess_entry,_remove_redundant_fields,_validate_entry, and_substitute_none_fieldsand_convert_fieldsto Period? (sorry for blowing this up so much :))
Do you mean cut and copy these methods into Period class? Should I keep the staticmethod decorators?
I noticed that the change is still a bit trickier... I'd like to have the methods of Period run validation of passed parameters (e.g. for add_entry()), such that methods in derived Period classes can re-use it via super() - so I'm not merging it yet.