# this is the brains of my vending machine

#so that I can accept or reject coins
from Coin import coins

#using coins
Coins = coins()

from Products import products

#using products
Products = products()

class machine(object): 
	def __init__(self): 
		self.display = "INSERT COINS"
		self.coinsInserted=[]
		self.amountInserted = 0.00
		self.items = {} 
		self.returnCoin = []
		self.returnCoinAmount = 0
		self.acceptedCoins = {"nickle":.05, 'dime': .10, 'quarter': .25} 
		self.coinsInMachine = []
		self.amountInMachine = 0

	def getVendDisplay(self):
		if self.display == "THANK YOU":
			hold = self.display
			if self.amountInserted > 0.00: 
				self.display = "${0:.2f}".format(self.amountInserted)
			else:
Esempio n. 2
0
# so that I can test the vaild inserts of money
import unittest

#so that I can test the money
from Coin import coins

#used for random testing 
from random import randint

money = coins()

class TestMoneyUnits(unittest.TestCase):
	def setUp(self): 
		pass

	def test_if_penny_exist(self):		
		#test that penny exist
		amount = money.getAmount('penny')
		self.assertEqual(amount, .01)		

	def test_if_nickle_exist(self):	
		#test that nickle exist
		amount = money.getAmount('nickle')
		self.assertEqual(amount, .05)

	def test_if_dime_exist(self):	
		#test that dime exist
		amount = money.getAmount('dime')
		self.assertEqual(amount, .1)

	def test_if_quarter_exist(self):