Skip to content

Commit b065206

Browse files
committed
2 parents e59c163 + a041029 commit b065206

2 files changed

Lines changed: 8 additions & 8 deletions

File tree

penn/calendar3year.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,11 @@ def pull_3year(self):
2929
elif line[:7] == "DTSTART":
3030
raw_date = line.split(":")[1]
3131
start_date = datetime.datetime.strptime(raw_date, '%Y%m%d').date()
32-
d['start'] = start_date
32+
d['start'] = start_date.strftime('%Y-%m-%d')
3333
elif line[:5] == "DTEND":
3434
raw_date = line.split(":")[1]
3535
end_date = datetime.datetime.strptime(raw_date,'%Y%m%d').date()
36-
d['end'] = end_date
36+
d['end'] = end_date.strftime('%Y-%m-%d')
3737
elif line[:7] == "SUMMARY":
3838
name = line.split(":")[1]
3939
d['name'] = name.encode('utf-8').strip()

tests/calendar_test.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,21 +19,21 @@ def test_date(self):
1919
for event in l:
2020
if event['name'] == "Independence Day Observed (no classes)":
2121
independence = event['start']
22-
ok_(isinstance(independence, datetime.date))
23-
ok_(independence.month == 7)
22+
d = datetime.datetime.strptime(independence, '%Y-%m-%d').date()
23+
ok_(d.month == 7)
2424

2525
def test_name(self):
2626
l = self.calendar.pull_3year()
2727
ok_(len(l) > 0)
2828
for event in l:
29-
start = event['start']
30-
end = event['end']
29+
start = datetime.datetime.strptime(event['start'], '%Y-%m-%d').date()
30+
end = datetime.datetime.strptime(event['end'], '%Y-%m-%d').date()
3131
ok_((end - start).total_seconds() >= 0)
3232

3333
def test_chrono(self):
3434
l = self.calendar.pull_3year()
3535
ok_(len(l) > 0)
3636
for i, event in enumerate(l[:-1]):
37-
start = event['start']
38-
nextstart = l[i]['start']
37+
start = datetime.datetime.strptime(event['start'], '%Y-%m-%d').date()
38+
nextstart = datetime.datetime.strptime(l[i]['start'], '%Y-%m-%d').date()
3939
ok_((nextstart - start).total_seconds() >= 0)

0 commit comments

Comments
 (0)