當前位置: 首頁>>代碼示例>>Python>>正文


Python Movie.addTicket方法代碼示例

本文整理匯總了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)
開發者ID:amreis,項目名稱:dojo-ufrgs,代碼行數:9,代碼來源:testMovie.py

示例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)
開發者ID:amreis,項目名稱:dojo-ufrgs,代碼行數:10,代碼來源:testMovie.py

示例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)
開發者ID:amreis,項目名稱:dojo-ufrgs,代碼行數:57,代碼來源:testMovie.py

示例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)
開發者ID:amreis,項目名稱:dojo-ufrgs,代碼行數:8,代碼來源:testMovie.py


注:本文中的movie.Movie.addTicket方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。