Skip to content

Commit dbc032a

Browse files
author
Reijonen Pekka
committed
random trying
1 parent 612fdb8 commit dbc032a

7 files changed

Lines changed: 41 additions & 2 deletions

File tree

dataSelection/selectingMain.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
def selectionMain(row):
22
# this should be used to remove lines from data frame, so should return true or false
3-
return "foo"
3+
return "foo"
4+

dataTransforming/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,4 @@
1010

1111

1212

13+

dataTransforming/transformingMain.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,10 @@ def transformationTestingWithApply(cell):
1616

1717
def columnBHandling(cell):
1818
result = cell - 5
19-
return result
19+
return result
20+
21+
22+
def transformFoo():
23+
return "something"
24+
25+
# REAL FUNCTIONS BELOW THIS FILE

pipeLine.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
import urllib.request
33
import time
44
from bs4 import BeautifulSoup
5+
6+
import tools
57
# INSTRUCTIONS
68
# Mocking https://docs.python.org/3/library/unittest.mock-examples.html
79
# google: python unittest mock tutorial
@@ -18,6 +20,7 @@
1820
# example: conda create -n env-01 python=3.8.2
1921

2022
def getData():
23+
temp = tools.tools.laughing()
2124
# url = 'http://web.mta.info/developers/turnstile.html'
2225
url = 'http://api.worldbank.org/v2/country/all/indicator/SP.POP.TOTL?format=json'
2326
response = requests.get(url) # task: mock this function. if applicable use with your own data source (URL)

tests.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
from example_pkg import bar_func
1313
from dataTransforming import transformationForData
1414
from dataTransforming import transformationTestingWithApply
15+
from dataTransforming import transformFoo
1516

1617
from functools import reduce
1718
import pandas as pd
@@ -20,6 +21,13 @@
2021
url = 'http://api.worldbank.org/v2/country/all/indicator/SP.POP.TOTL?format=json'
2122

2223
class TestMethods_live(unittest.TestCase):
24+
def test_transformation(self):
25+
# call to function changing some "global" data structure
26+
# assert function is checking that the change you expected happens properly.
27+
result = transformFoo()
28+
self.assertEqual("foo", result)
29+
self.assertEqual(awesome.smile(), ":)")
30+
2331
def test_assertion_1(self):
2432
# call to function changing some "global" data structure
2533
# assert function is checking that the change you expected happens properly.

tools/__init__.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
'''
2+
This is a package called dataTransforming (a folder name)
3+
Instructions: to this file import source code files (modules) one by one.
4+
When using functions do not mention source code files (modules), only functions inside those source code files.
5+
Example on how to import function from this package
6+
from dataTransforming import transformationForData
7+
'''
8+
9+
from .tools import *
10+
11+
12+
13+
14+

tools/tools.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
2+
def laughing():
3+
return ":D"
4+
5+
def laughingPara(parastring):
6+
return ":D" + parastring

0 commit comments

Comments
 (0)