本文整理匯總了Python中movie.Movie.addTicket方法的典型用法代碼示例。如果您正苦於以下問題:Python Movie.addTicket方法的具體用法?Python Movie.addTicket怎麽用?Python Movie.addTicket使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類movie.Movie
的用法示例。
在下文中一共展示了Movie.addTicket方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: testMovieWeekend
# 需要導入模塊: from movie import Movie [as 別名]
# 或者: from movie.Movie import addTicket [as 別名]
def testMovieWeekend(self):
m = Movie(121, "Saturday", True, True)
m.addTicket(20,False)
price = m.finishPurchase()
self.assertEquals(price, 17.0)
示例2: testGoingWithLotsOfPeopleOnThursday
# 需要導入模塊: from movie import Movie [as 別名]
# 或者: from movie.Movie import addTicket [as 別名]
def testGoingWithLotsOfPeopleOnThursday(self):
m = Movie(110, "Thursday", True, True)
for i in range(30):
m.addTicket(20+i,True)
price = m.finishPurchase()
self.assertEquals(price,30 * 9)
示例3: testMovie
# 需要導入模塊: from movie import Movie [as 別名]
# 或者: from movie.Movie import addTicket [as 別名]
class testMovie(unittest.TestCase):
def setUp(self):
self.m = Movie(160,"Monday", True, True)
def testMovieBasic(self):
# addTicket (age, isStudent)
self.m.addTicket(30,False)
price = self.m.finishPurchase()
self.assertEquals(price,15.50)
def testMovieEldery(self):
self.m.addTicket(66, False)
price = self.m.finishPurchase()
self.assertEquals(price, 10.50)
def testMovieStudent(self):
self.m.addTicket(10, True)
price = self.m.finishPurchase()
self.assertEquals(price, 10.0)
def testMovieManyPeople(self):
for i in range(10):
self.m.addTicket(22, True)
price = self.m.finishPurchase()
self.assertEquals(price, 125.0)
def testMovieManyManyManyPeople(self):
for i in range(20):
self.m.addTicket(22, True)
price = self.m.finishPurchase()
self.assertEquals(price, 20*10.5 )
def testMovieThursday(self):
m = Movie(110, "Thursday", True, True)
m.addTicket(10,True)
price = m.finishPurchase()
self.assertEquals(price,6.5)
def testGoingWithLotsOfPeopleOnThursday(self):
m = Movie(110, "Thursday", True, True)
for i in range(30):
m.addTicket(20+i,True)
price = m.finishPurchase()
self.assertEquals(price,30 * 9)
def testMovieWeekend(self):
m = Movie(121, "Saturday", True, True)
m.addTicket(20,False)
price = m.finishPurchase()
self.assertEquals(price, 17.0)
示例4: testMovieThursday
# 需要導入模塊: from movie import Movie [as 別名]
# 或者: from movie.Movie import addTicket [as 別名]
def testMovieThursday(self):
m = Movie(110, "Thursday", True, True)
m.addTicket(10,True)
price = m.finishPurchase()
self.assertEquals(price,6.5)