def test_where_returns_correct_keys(): row = FundingRaised.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_no_events(): assert len(FundingRaised.where({'company_name': 'NotFacebook'})) == 0
def test_where_returns_events_by_type(): assert len(FundingRaised.where({'round': 'a'})) == 582
def test_where_returns_events_by_company(): assert len(FundingRaised.where({ 'company_name': 'Facebook', 'round': 'a' })) == 1
def test_where_returns_events_by_state(): assert len(FundingRaised.where({'state': 'CA'})) == 873
def test_where_returns_events_by_city(): assert len(FundingRaised.where({'city': 'Tempe'})) == 3