def test_host(self): club = Venue("Berkeley City Club", "2315 Durant Avenue") rager = Performance("Nathan Trinkl's Birthday Bash", datetime.datetime(18, 3, 16, 9, 55)) self.assertTrue(rager not in club.events) club.host(rager) self.assertTrue(rager in club.events)
def test_approve_for_not_hosted_event(self): club = Venue("Berkeley City Club", "2315 Durant Avenue") anant = Performer("Anant Sahai", 94704, "I reenact animes.") rager = Performance("Nathan Trinkl's Birthday Bash", datetime.datetime(18, 3, 16, 9, 55)) anant.apply_to(rager) with self.assertRaises(ValueError): club.approve(anant, rager)
def test_host_overlapping_events(self): club = Venue("Berkeley City Club", "2315 Durant Avenue") rager = Performance("Steven Huangs's Birthday Bash", datetime.datetime(18, 3, 16, 9, 45)) rave = Performance("Japanese Pop Rave", rager.start_time + datetime.timedelta(minutes=10)) club.host(rager) with self.assertRaises(ValueError): club.host(rave)
def test_approve(self): club = Venue("Berkeley City Club", "2315 Durant Avenue") anant = Performer("Anant Sahai", 94704, "I reenact animes.") rager = Performance("Nathan Trinkl's Birthday Bash", datetime.datetime(18, 3, 16, 9, 55)) club.host(rager) anant.apply_to(rager) self.assertTrue(anant not in rager.approved_performers) club.approve(anant, rager) self.assertTrue(anant in rager.approved_performers)
def test_eq(self): club1 = Venue("Berkeley City Club", "2315 Durant Avenue") club2 = Venue("Berkeley City Club", "2315 Durant Avenue") self.assertEqual(club1, club2) hall = Venue("Carnegie Hall", "6124 Jefferson Street") self.assertNotEqual(club1, hall)
def test_repr(self): club = Venue("Berkeley City Club", "2315 Durant Avenue") self.assertEqual(repr(club), "Venue('Berkeley City Club', '2315 Durant Avenue')")
def test_str(self): club = Venue("Berkeley City Club", "2315 Durant Avenue") self.assertEqual(str(club), "Berkeley City Club")
def test_constructor(self): club = Venue("Berkeley City Club", "2315 Durant Avenue") self.assertTrue(club.name, "Berkeley City Club") self.assertTrue(club.address, "2315 Durant Avenue")