示例#1
0
	def test_init(self):
		bag = BackPack()
		bag.add_stuff('apple',4,10)
		self.assertEquals(bag.show_stuffs(),{'apple':[4,40]})
		self.assertTrue(isinstance,(bag,dict))
示例#2
0
	def test_valueerror(self):
		bag = BackPack()
		with self.assertRaises(TypeError):
			bag.add_stuff('apple','4',10)
			bag.add_stuff('apple',4,'10')
			bag.get_stuff('apple','3')
示例#3
0
	def test_get_stuff(self):
		bag = BackPack()
		bag.add_stuff('apple',4,10)
		bag.get_stuff('apple',2)
		self.assertEquals(bag.show_stuffs(),{'apple':[2,20]})
示例#4
0
 def test_init(self):
     bag = BackPack()
     bag.add_stuff('apple', 4, 10)
     self.assertEquals(bag.show_stuffs(), {'apple': [4, 40]})
     self.assertTrue(isinstance, (bag, dict))
示例#5
0
 def test_valueerror(self):
     bag = BackPack()
     with self.assertRaises(TypeError):
         bag.add_stuff('apple', '4', 10)
         bag.add_stuff('apple', 4, '10')
         bag.get_stuff('apple', '3')
示例#6
0
 def test_get_stuff(self):
     bag = BackPack()
     bag.add_stuff('apple', 4, 10)
     bag.get_stuff('apple', 2)
     self.assertEquals(bag.show_stuffs(), {'apple': [2, 20]})