Skip to content

Commit

Permalink
修正Station.py中的错误
Browse files Browse the repository at this point in the history
  • Loading branch information
shizhx committed Jan 3, 2015
1 parent 71edd47 commit 07c6cfe
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Station.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def __init__(self, name, date, arrive_time, leave_time, distance):
def parse_Station(info):
"""从信息数组中解析构造一个Station对象"""
(IDX_NAME, IDX_DATE, IDX_ARRIVE, IDX_LEAVE, IDX_DIST) = range(5)
station = Station(info[IDX_NAME], info[IDX_DATE], info[IDX_ARRIVE] \
station = Station(info[IDX_NAME], info[IDX_DATE], info[IDX_ARRIVE], \
info[IDX_LEAVE], info[IDX_DIST])

return station
Expand Down
11 changes: 11 additions & 0 deletions src/test/test_station.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# 测试站点解析代码

import sys
sys.path.append("../")
from Station import Station

station = Station.parse_Station(["深圳西", "2015-1-2", "12:23", "13:34", 500])
print station.name, station.date, station.arrive_time, station.leave_time, station.distance

0 comments on commit 07c6cfe

Please sign in to comment.