Example #1
0
 def test_methods(self):
     prod3 = Product('Test Product No 3', price=int(20), weight=int(30), 
     flammability=float(0.8))
     self.assertEqual(prod3.stealability(), 'Kinda stealable')
Example #2
0
 def test_set_product_weight(self):
     """Test  set product weight being 100."""
     prod = Product(name='Test Product', weight=100)
     self.assertEqual(prod.weight, 100)
 def test_default_product_weight(self):
     """Test default product price being 10."""
     prod = Product('Test Product')
     self.assertEqual(prod.weight, 20)
Example #4
0
 def test_explosiveness(self):
     """Test the explosiveness of a Product."""
     prod_explode = Product('Test explosiveness', flammability=2, weight=25)
     self.assertEqual(prod_explode.explode(), "...BABOOM!!")
 def test_default_product_flammability(self):
     """Test default product weight being 20."""
     prod = Product('Test Product')
     self.assertEqual(prod.flammability, 0.5)
Example #6
0
 def test_explode(self):
     prod = Product('A Cool Toy', flammability=60)
     prod.explode()
Example #7
0
 def test_default_product_weight(self):
     """Test default product weight is 20."""
     prod = Product('Test weight')
     self.assertEqual(prod.weight, 20)
Example #8
0
    def test_default_product_price(self):
        """Test default product price being 10."""
        prod = Product('Test Product')
        self.assertEqual(prod.price, 10)

    def test_default_product_weight(self):
        # test default product weight = 20
        prod = Product('Test Product')
        self.assertEqual(prod.weight, 20)

    def test_default_product_flammability(self):
        prod = Product('Test Product')
        self.assertEqual(prod.flammability, .5)


class AcmeReportTests(unittest.TestCase):
    def test_default_num_products(self):
        self.assertEqual(len(generate_products()), 30)

    def test_legal_names(self):
        for product in generate_products():
            adjective, noun = product.name.split()
            self.assertIn(adjective, ADJECTIVES)
            self.assertIn(noun, NOUNS)


if __name__ == "__main__":
    test_product = Product('test', price=15, weight=25, flammability=2)
    print(test_product.explode(), test_product.stealability())
    unittest.main()
Example #9
0
 def test_default_product_weight(self):
     # test default product weight = 20
     prod = Product('Test Product')
     self.assertEqual(prod.weight, 20)
 def test_stealability(self):
     """ Test stealability equals Very stealable """
     prod2 = Product('Product Two', 21)
     self.assertEqual(prod2.stealability(), 'Very stealable!')
 def test_explode(self):
     """ Test explode equals baboom """
     prod3 = Product('Product Three', price=10, weight=50, flammability=1.1)
     self.assertEqual(prod3.explode(), '...BABOOM!!')
 def test_default_product_weight(self):
     """ Test default product weight being 20. """
     prod1 = Product('Product One')
     self.assertEqual(prod1.weight, 20)
Example #13
0
 def test_default_values(self):
     prod = Product(name='Test Product',
                    price=100,
                    weight=100,
                    flammability=100)
     self.assertEqual(prod.weight, 10)
    def test_default_product_stealabilityweight(self):
        prod = Product('Test Product')
        prod.price = 100
        prod.weight = 201
        self.assertEqual(prod.stealability(), 'Not so stealable...')

        prod = Product('Test Product')
        prod.price = 100
        prod.weight = 200
        self.assertEqual(prod.stealability(), 'Kinda stealable')

        prod = Product('Test Product')
        prod.price = 100
        prod.weight = 100
        self.assertEqual(prod.stealability(), 'Very stealable!')
Example #15
0
 def test_stealage(self):
     """Tests to see if report works for stealability"""
     prod = Product('Test Product', price=20, weight=1)
     self.assertEqual(prod.stealability(), 'Very stealable!')
Example #16
0
 def test_default_proudct_flamm)self:
     """Test default product price being 0.5."""
     prod = Product('Test Product')
     self.assertEqual(prod.flammability, 0.5)
Example #17
0
 def test_stealability(self):
     prod = Product('A Cool Toy', price=500)
     prod.stealability()
 def test_product_methods(self):
     """Test default product weight being 20."""
     prod = Product('Test Product', 10, 30, .8)
     self.assertEqual(prod.explode(), '...boom!')
     self.assertEqual(prod.stealability(), 'Not so stealable...')
Example #19
0
 def test_product(self):
     prod = Product('A Cool Toy')
     self.assertEqual(prod.name, 'A Cool Toy')
     self.assertEqual(prod.price, 10)
     prod.explode()
     prod.stealability()
 def __init__(self, name="Product", price=10, weight=10, flammability=0.5, identifier=(random.randint(1000000, 9999999))):
   Product.__init__(self, name="Product", price=10, weight=10, flammability=0.5, identifier=(random.randint(1000000, 9999999)))
Example #21
0
 def test_stealabilty(self):
     """Test the stealability of a Product."""
     prod_steal = Product('Test stealability', price=20, weight=20)
     self.assertEqual(prod_steal.stealability(), "Very stealable!")
Example #22
0
 def test_stealability(self):
     prod = Product('Test Product', price=10, weight=20)
     self.assertEqual(prod.stealability(), 'Kinda Stealable')
Example #23
0
 def test_explode(self):
     self.assertTrue(Product().explode) == 10.0
Example #24
0
 def test_explode(self):
     prod = Product('Test Product', weight=20, flammability=0.5)
     self.assertEqual(prod.explode(), '...boom!')
 def test_default_num_products(self):
     prod = Product('Test Different', price=5, weight=20, flammability=0.7)
     self.assertEqual(prod.flammability, 0.7)
     self.assertEqual(prod.explode(), '...boom!')
Example #26
0
 def test_default_product_flammability(self):
     prod = Product('Test Product')
     self.assertEqual(prod.flammability, 0.5)
 def test_explode(self):
     """Test explode method"""
     prod = Product('Test Product', flammability=3, weight=10)
     self.assertEqual(prod.explode(), print("...boom!"))
Example #28
0
 def test_explode(self):
     """Test if the product will actually explode it ratio is high"""
     prod = Product('Test Product', weight=20, flammability=20)
     self.assertEqual(prod.explode(), '...BABOOOOMMMm!!!!')
 def test_default_product_price(self):
     """Test default product price being 10."""
     prod = Product('Test Product')
     self.assertEqual(prod.price, 10)
Example #30
0
 def test_default_product_weight(self):
     prod2 = Product('Test Product No 2')
     self.assertEqual(prod2.weight, 20)