-
Notifications
You must be signed in to change notification settings - Fork 0
/
unit-tests.py
57 lines (45 loc) · 1.28 KB
/
unit-tests.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
from config import crunchbase_api_key
from helper import *
from loggg import logUnitTest
################# UNIT TESTS
def filterUnitTest():
# Tests filters based on titles
result = ""
strings = ("Founder", "President", "CEO", "CXO")
for s in strings:
if not titleFilter(s):
result = result + "failed " + s + "\n"
if not result:
result = "Passed!"
return result
def confidenceUnitTest():
# tests confidence level heuristics
s = ""
if calcConfidence(3,0) != 100:
s = s + "failed 100\n"
if calcConfidence(2,0) != 80:
s = s + "failed 80\n"
if calcConfidence(1,0) != 60:
s = s + "failed 60\n"
if calcConfidence(0,3) != 50:
s = s + "failed 50\n"
if calcConfidence(0,2) != 20:
s = s + "failed 20\n"
if calcConfidence(0,0) != 0:
s = s + "failed 0\n"
if not s:
s = "Passed!"
return s
def CBUnitTests():
# tests Crunchbase API functions
s = ""
if not getCrunchbaseLinkedinURL("Moses Lee", "mosesklee", crunchbase_api_key):
s = s + "CB LinkedIn failed!\n"
if not getCrunchbaseOrgData("Seelio", "fb867477-36ec-872b-ec9f-75fe1945de35", crunchbase_api_key)
s = s + "CB Org Data failed!\n"
if not s:
s = "Passed!"
return s
logUnitTest("Filters", filterUnitTest())
logUnitTest("Confidence test", confidenceUnitTest())
logUnitTest("Crunchbase tests", CBUnitTests())