Completed
Push — master ( e94592...1faa13 )
by Adam
11s
created

EaseOfUse   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 10
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 10
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A test_lines() 0 6 1
A setUp() 0 2 1
1
import unittest
2
from tube.tubeAPI import Tube
3
from tube.tubeAPI import TubeLine, TubeStation
4
5
from tube.tubeAPI import TubeLineManager, TubeStationManager
6
7
class EaseOfUse(unittest.TestCase):
8
	def setUp(self):
9
		self.tube = Tube()
10
		
11
	def test_lines(self):
12
		self.assertEqual( type(self.tube.lines), TubeLineManager )
13
		self.assertEqual( type(self.tube.lines['C']), TubeLine )
14
		
15
		self.assertEqual( type(self.tube.stations) , TubeStationManager)
16
		self.assertEqual( type(self.tube.stations['OXC']) , TubeStation)
17
		
18
19
def test_TFLObject():
20
	'''
21
	Test implementation of TFL object
22
	[ note: time dependent test, will not pass]
23
24
	>>> from tflTube import TFL
25
	>>> tfl = TFL()
26
	>>> tfl.map.get(linecode='V')
27
	<tflTube.TFLLine: Victoria>
28
29
	>>> tfl.map.get(linecode='V').getStations()
30
	{'VIC': <tflTube.TFLStation: Victoria>, 'WAL': <tflTube.TFLStation: Walthamstow Central>, 'PIM': <tflTube.TFLStation: Pimlico>, 'GPK': <tflTube.TFLStation: Green Park>, 'WST': <tflTube.TFLStation: Warren Street>, 'BRX': <tflTube.TFLStation: Brixton>, 'FPK': <tflTube.TFLStation: Finsbury Park>, 'STK': <tflTube.TFLStation: Stockwell>, 'KXX': <tflTube.TFLStation: King's Cross St Pancras>, 'TTH': <tflTube.TFLStation: Tottenham Hale>, 'HBY': <tflTube.TFLStation: Highbury and Islington>, 'VUX': <tflTube.TFLStation: Vauxhall>, 'BHR': <tflTube.TFLStation: Blackhorse Road>, 'SVS': <tflTube.TFLStation: Seven Sisters>, 'EUS': <tflTube.TFLStation: Euston>, 'OXC': <tflTube.TFLStation: Oxford Circus>}
31
32
	>>> tfl.map.get(stationcode="OXC")
33
	<tflTube.TFLStation: Oxford Circus>
34
35
	>>> tfl.map.get(linecode="B")
36
	<tflTube.TFLLine: Bakerloo>
37
38
	>>> tfl.map.get(linecode="B", stationcode="OXC").platforms
39
	{u'Northbound - Platform 4': <tflTube.TFLPlatform: Bakerloo Northbound - Platform 4 >, u'Southbound - Platform 3': <tflTube.TFLPlatform: Bakerloo Southbound - Platform 3 >}
40
41
	>>> tfl.map.get(linecode="V").getAllTrains()
42
	{u'1019265': <tflTube.TFLTrain LCID(1019265) on Victoria Line at Between Highbury & Islington and Kings Cross St. P>, u'1019894': <tflTube.TFLTrain LCID(1019894) on Victoria Line at At Brixton Platform 2>, u'1020196': <tflTube.TFLTrain LCID(1020196) on Victoria Line at At Victoria>, u'1018651': <tflTube.TFLTrain LCID(1018651) on Victoria Line at At Blackhorse Road>, u'1019837': <tflTube.TFLTrain LCID(1019837) on Victoria Line at Between Kings Cross St. Pancras and Highbury & Isl>, u'1018285': <tflTube.TFLTrain LCID(1018285) on Victoria Line at Between Seven Sisters and Finsbury Park>, u'1018931': <tflTube.TFLTrain LCID(1018931) on Victoria Line at Between Tottenham Hale and Blackhorse Road>, u'1019444': <tflTube.TFLTrain LCID(1019444) on Victoria Line at At Vauxhall>, u'1019373': <tflTube.TFLTrain LCID(1019373) on Victoria Line at Between Finsbury Park and Seven Sisters>, u'1016438': <tflTube.TFLTrain LCID(1016438) on Victoria Line at Between Oxford Circus and Warren Street>, u'1018584': <tflTube.TFLTrain LCID(1018584) on Victoria Line at Between Kings Cross St. Pancras and Euston>, u'1016265': <tflTube.TFLTrain LCID(1016265) on Victoria Line at Approaching Stockwell>, u'1019561': <tflTube.TFLTrain LCID(1019561) on Victoria Line at At Walthamstow Central>, u'1020270': <tflTube.TFLTrain LCID(1020270) on Victoria Line at Northumberland Park Depot Area>, u'1018676': <tflTube.TFLTrain LCID(1018676) on Victoria Line at Between Warren Street and Oxford Circus>, u'1018480': <tflTube.TFLTrain LCID(1018480) on Victoria Line at At Oxford Circus>, u'1017788': <tflTube.TFLTrain LCID(1017788) on Victoria Line at Between Pimlico and Victoria>, u'1020123': <tflTube.TFLTrain LCID(1020123) on Victoria Line at At Green Park>, u'1016226': <tflTube.TFLTrain LCID(1016226) on Victoria Line at Between Walthamstow Central and Blackhorse Road>, u'1015704': <tflTube.TFLTrain LCID(1015704) on Victoria Line at Departed Highbury & Islington>, u'1019728': <tflTube.TFLTrain LCID(1019728) on Victoria Line at At Seven Sisters Platform 5>, u'1016783': <tflTube.TFLTrain LCID(1016783) on Victoria Line at At Brixton Platform 1>, u'1019976': <tflTube.TFLTrain LCID(1019976) on Victoria Line at Between Finsbury Park and Highbury & Islington>, u'1018094': <tflTube.TFLTrain LCID(1018094) on Victoria Line at At Euston>, u'1019666': <tflTube.TFLTrain LCID(1019666) on Victoria Line at Between Pimlico and Vauxhall>, u'1016351': <tflTube.TFLTrain LCID(1016351) on Victoria Line at Departed Finsbury Park>, u'1018158': <tflTube.TFLTrain LCID(1018158) on Victoria Line at At Stockwell>, u'1017691': <tflTube.TFLTrain LCID(1017691) on Victoria Line at At Platform>}
43
44
	>>> tfl.map.get(stationcode="OXC").getAllTrains()
45
	{'trains': {u'1018651': <tflTube.TFLTrain LCID(1018651) on Victoria Line at Approaching Tottenham Hale>, u'1017788': <tflTube.TFLTrain LCID(1017788) on Victoria Line at At Victoria>, u'1019728': <tflTube.TFLTrain LCID(1019728) on Victoria Line at Between Seven Sisters and Finsbury Park>, u'1018285': <tflTube.TFLTrain LCID(1018285) on Victoria Line at At Finsbury Park>, u'1016783': <tflTube.TFLTrain LCID(1016783) on Victoria Line at Brixton Area>, u'1019976': <tflTube.TFLTrain LCID(1019976) on Victoria Line at At Highbury & Islington>, u'1019894': <tflTube.TFLTrain LCID(1019894) on Victoria Line at At Brixton Platform 2>, u'1019265': <tflTube.TFLTrain LCID(1019265) on Victoria Line at At Kings Cross St. Pancras>, u'1016226': <tflTube.TFLTrain LCID(1016226) on Victoria Line at At Walthamstow Central>, u'1019444': <tflTube.TFLTrain LCID(1019444) on Victoria Line at At Pimlico>, u'1016438': <tflTube.TFLTrain LCID(1016438) on Victoria Line at At Oxford Circus>, u'1018584': <tflTube.TFLTrain LCID(1018584) on Victoria Line at Between Warren Street and Euston>, u'1020123': <tflTube.TFLTrain LCID(1020123) on Victoria Line at Approaching Oxford Circus>, u'1019561': <tflTube.TFLTrain LCID(1019561) on Victoria Line at At Walthamstow Central>, u'1020270': <tflTube.TFLTrain LCID(1020270) on Victoria Line at Between Northumberland Park Depot and Seven Sisters>, u'1018158': <tflTube.TFLTrain LCID(1018158) on Victoria Line at Between Stockwell and Vauxhall>}}
46
47
	>>> tfl.map.get(linecode="B", stationcode="OXC").getAllTrains()
48
	{u'1020241': <tflTube.TFLTrain LCID(1020241) on Bakerloo Line at Approaching Paddington>, u'1019966': <tflTube.TFLTrain LCID(1019966) on Bakerloo Line at Between Regents Park and Oxford Circus>, u'1020119': <tflTube.TFLTrain LCID(1020119) on Bakerloo Line at At Embankment Platform 5>, u'1019579': <tflTube.TFLTrain LCID(1019579) on Bakerloo Line at Queen's Park North Sidings>, u'1020129': <tflTube.TFLTrain LCID(1020129) on Bakerloo Line at At Waterloo Platform 3>, u'1019713': <tflTube.TFLTrain LCID(1019713) on Bakerloo Line at At Queen's Park Platform 2>, u'1019521': <tflTube.TFLTrain LCID(1019521) on Bakerloo Line at At Marylebone Platform 2>, u'1019884': <tflTube.TFLTrain LCID(1019884) on Bakerloo Line at At Elephant & Castle Platform 3>}
49
50
	'''
51
	pass
52
53
54
55
56
57
58