def test_can_retrieve_valid_index(self): past_team = Page('data', DATA) one = past_team.get(0) self.assertEqual(one.name, "Facebook") self.assertEqual(one.permalink, "facebook") self.assertEqual(one.api_path, "organizations/facebook") self.assertEqual(one.web_path, "organization/facebook")
def test_passing_in_bad_key(self): past_team = Page('data', DATA) with self.assertRaises(TypeError): past_team['bad'] self.assertEqual(past_team[0], past_team.get(0))
def test_retrieving_out_of_bound_index(self): past_team = Page('data', DATA) with self.assertRaises(IndexError): past_team.get(2)
def test_can_retrieve_valid_index(self): past_team = Page('data', DATA) one = past_team.get(0) self.assertEqual(one.name, "Example") self.assertEqual(one.permalink, "example")
def test_iterate(self): past_team = Page('data', DATA) members = [member for member in past_team] self.assertEqual(1, len(members)) self.assertEqual(past_team[0], members[0])