wilsonfreitas / python-bizdays

Business days calculations and utilities
http://wilsonfreitas.github.io/python-bizdays/
MIT License
80 stars 34 forks source link

Use isinstance instead of type() #25

Closed WhyNotHugo closed 4 years ago

WhyNotHugo commented 5 years ago

Using type(): checks that the type of an argument is EXACTLY a given class, and will not match if we're using a subclass.

I'm using a project that uses freezegun for testing, so our date objects are actually subclasses of datetime.date, and not instances of exactly that class.

This change does not break existing functionality, and should not break even under very odd scenarios which haven't been considered so far.

artemgordinskiy commented 4 years ago

@wilsonfreitas Could you take a look at this PR? 🙏

wilsonfreitas commented 4 years ago

OK, merged!

artemgordinskiy commented 4 years ago

@wilsonfreitas Awesome, thank you!

wilsonfreitas commented 4 years ago

I have made many changes in this project during the last week. Maybe a few things work differently. Please, let me know if you have any problem. Tks.

artemgordinskiy commented 4 years ago

@wilsonfreitas Thanks! So far, the new version is looking good – haven't noticed any issues, and none of our tests have failed (many of which rely on this library). I'll let you know if we see any problems.