-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfoo.py
More file actions
20 lines (16 loc) · 725 Bytes
/
foo.py
File metadata and controls
20 lines (16 loc) · 725 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# had to import this myself 😛
import datetime
# So this was all copilot created
def calculate_days_between_dates(begin, end):
begin_date = datetime.datetime.strptime(begin, "%Y-%m-%d")
end_date = datetime.datetime.strptime(end, "%Y-%m-%d")
return ( abs((begin_date - end_date).days))
# So this was all copilot created
def test_calculate_days_between_dates():
""" Test for calculate_days_between_dates """
assert calculate_days_between_dates("2016-01-15", "2016-01-21") == 6
assert calculate_days_between_dates("2016-01-01", "2016-01-01") == 0
assert calculate_days_between_dates("2016-01-01", "2016-01-02") == 1
print()
print("All tests passed!")
test_calculate_days_between_dates()