File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1818def getData ():
1919 # url = 'http://web.mta.info/developers/turnstile.html'
2020 url = 'http://api.worldbank.org/v2/country/all/indicator/SP.POP.TOTL?format=json'
21- response = requests .get (url )
21+ response = requests .get (url ) # task: mock this function. if applicable use with your own data source (URL)
2222 return response
2323
2424
Original file line number Diff line number Diff line change 22
33import awesome
44import example_pkg
5+ import pipeLine
56
7+ url = 'http://api.worldbank.org/v2/country/all/indicator/SP.POP.TOTL?format=json'
68
79class TestMethods (unittest .TestCase ):
810 def test_add (self ):
11+ # call to function changing some "global" data structure
12+ # assert function is checking that the change you expected happens properly.
913 self .assertEqual (awesome .smile (), ":)" )
1014
1115 def test_anotherOne (self ):
@@ -14,6 +18,10 @@ def test_anotherOne(self):
1418 bazres = example_pkg .baz_func ()
1519 self .assertRegexpMatches (barres ,".*bar.*" )
1620
21+ def test_pipeline (self ):
22+ result = pipeLine .getData (url )
23+ self .assertRegexpMatches (barres ,".*bar.*" )
24+
1725
1826if __name__ == '__main__' :
1927 unittest .main ()
You can’t perform that action at this time.
0 commit comments