当前位置: 首页>>代码示例>>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;未经允许,请勿转载。