Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Here is my simple take on the toll calculator.
Used pytest for testing and also added a pip package called holidays to check for all Swedish holiday dates.
Vheicles.py file defines an abstract class Vehicle and then all vehicle types that the toll calculator handles inherit from the vehicle class. Added a class function 'is_vehicle_tollable()' so if in the future more vehicle types should be charged it would be easy to find where to make the changes.
TollCalculator.py does the calculation of the toll fee given a list of dates and a vehicle. The list of dates can span over multiple days and it will still calculate the correct amount.
TollDate.py handles if the date is a tollable date and also the fee ruling.
app.py and input_configs.py is used for running the program and have some sort of real life test input.
_Would love to sit down and discuss my solution and how it could be improved.
mvh,
Andreas Ypper_