示例#1
0
import products
#from products import groupedProducts

#print dir(products)

productMap = products.groupedProducts()

print products.mostPopularProduct(productMap)
print products.leastPopularProduct(productMap)
示例#2
0
import products
import unittest
productMap = products.groupedProducts()
mostPopularPdt = products.mostPopularProduct(productMap)
leastPopularPdt = products.leastPopularProduct(productMap)

class MyTest(unittest.TestCase):
    def test_mostPopularProduct(self):
    	print mostPopularPdt
        self.assertEqual('Mixed Sweets 5s', mostPopularPdt['mostPopular'])
        self.assertEqual(172, mostPopularPdt['qty'])

    def test_leastPopularProduct(self):
    	print leastPopularPdt
    	self.assertEqual('Valentine Cards', leastPopularPdt['leastPopular'])
        self.assertEqual(14, leastPopularPdt['qty'])

if __name__ == '__main__':
    unittest.main()
示例#3
0
import products
#from products import groupedProducts

#print dir(products)

productMap = products.groupedProducts()

print products.mostPopularProduct(productMap)
print products.leastPopularProduct(productMap)