コード例 #1
0
 def test_uses_default_weight_when_attribute_is_missing(self):
     scales = Scales(attribute_code='weight', default_weight=0.5)
     p = factories.create_product()
     self.assertEqual(0.5, scales.weigh_product(p))
コード例 #2
0
 def test_raises_exception_when_attribute_is_missing(self):
     scales = Scales(attribute_code='weight')
     p = factories.create_product()
     with self.assertRaises(ValueError):
         scales.weigh_product(p)
コード例 #3
0
 def test_weighs_uses_specified_attribute(self):
     scales = Scales(attribute_code='weight')
     p = factories.create_product(attributes={'weight': '1'})
     self.assertEqual(1, scales.weigh_product(p))
コード例 #4
0
 def test_simple_weight_calculation(self):
     scales = Scales(attribute_code='weight')
     p = create_product(attributes={'weight': 1})
     self.assertEqual(1, scales.weigh_product(p))
コード例 #5
0
 def test_exception_is_raised_when_attribute_is_missing(self):
     scales = Scales(attribute_code="weight")
     p = create_product()
     with self.assertRaises(ValueError):
         scales.weigh_product(p)
コード例 #6
0
 def test_default_weight_is_used_when_attribute_is_missing(self):
     scales = Scales(attribute_code="weight", default_weight=0.5)
     p = create_product()
     self.assertEqual(0.5, scales.weigh_product(p))
コード例 #7
0
ファイル: shipping_tests.py プロジェクト: waytai/django-oscar
 def test_simple_weight_calculation(self):
     scales = Scales(attribute_code='weight')
     p = create_product(attributes={'weight': 1})
     self.assertEqual(1, scales.weigh_product(p))