-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtest.py
50 lines (40 loc) · 2.24 KB
/
test.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
from fundingRaised import Funding_Raised
def test_where_returns_events():
assert len(Funding_Raised.where({'company_name': 'Facebook'})) == 7
def test_where_returns_correct_keys():
row = Funding_Raised.where({'company_name': 'Facebook'})[0]
keys = ['permalink', 'company_name', 'number_employees', 'category', 'city', 'state', 'funded_date', 'raised_amount', 'raised_currency', 'round']
values = ['facebook', 'Facebook', '450', 'web', 'Palo Alto', 'CA', '1-Sep-04', '500000', 'USD', 'angel']
for i in range(0, len(keys)):
assert row[keys[i]] == values[i]
def test_where_returns_events_by_city():
assert len(Funding_Raised.where({'city': 'Tempe'})) == 3
def test_where_returns_events_by_state():
assert len(Funding_Raised.where({'state': 'CA'})) == 873
def test_where_returns_events_by_company():
assert len(Funding_Raised.where({'company_name': 'Facebook', 'round': 'a'})) == 1
def test_where_returns_events_by_type():
assert len(Funding_Raised.where({'round': 'a'})) == 582
def test_where_returns_no_events():
assert len(Funding_Raised.where({'company_name': 'NotFacebook'})) == 0
def test_find_by_event_by_company_name():
row = Funding_Raised.find_by({'company_name': 'Facebook'})
keys = ['permalink', 'company_name', 'number_employees', 'category', 'city', 'state', 'funded_date', 'raised_amount', 'raised_currency', 'round']
values = ['facebook', 'Facebook', '450', 'web', 'Palo Alto', 'CA', '1-Sep-04', '500000', 'USD', 'angel']
for i in range(0, len(keys)):
assert row[keys[i]] == values[i]
def test_find_by_event_by_state():
row = Funding_Raised.find_by({'state': 'CA'})
keys = ['permalink', 'company_name', 'number_employees', 'category', 'city', 'state', 'funded_date', 'raised_amount', 'raised_currency', 'round']
values = ['digg', 'Digg', '60', 'web', 'San Francisco', 'CA', '1-Dec-06', '8500000', 'USD', 'b']
for i in range(0, len(keys)):
assert row[keys[i]] == values[i]
test_where_returns_events()
test_where_returns_correct_keys()
test_where_returns_events_by_city()
test_where_returns_events_by_state()
test_where_returns_events_by_company()
test_where_returns_events_by_type()
test_where_returns_no_events()
test_find_by_event_by_company_name()
test_find_by_event_by_state()