Exemplo n.º 1
0
    def test_getters_and_setters(self):
        item = Item(24, 666)

        item.count = '44'
        item.price = '666'
        item.description = 'Foo bar'
        item.unit = 'hour'
        item.tax = '99.9'

        self.assertIsInstance(item.count, float)
        self.assertIsInstance(item.price, float)
        self.assertIsInstance(item.description, unicode)
        self.assertIsInstance(item.unit, unicode)
        self.assertIsInstance(item.tax, float)
Exemplo n.º 2
0
    def test_getters_and_setters(self):
        item = Item(24, 666)

        item.count = '44'
        item.price = '667'
        item.description = 'Foo bar'
        item.unit = 'hour'
        item.tax = '99.9'

        self.assertIsInstance(item.count, Decimal)
        self.assertEqual(item.count, 44)
        self.assertIsInstance(item.price, Decimal)
        self.assertEqual(item.price, 667)
        self.assertIsInstance(item.description, string_types)
        self.assertIsInstance(item.unit, string_types)
        self.assertIsInstance(item.tax, Decimal)
        self.assertEqual(item.tax, Decimal('99.9'))
Exemplo n.º 3
0
    def test_getters_and_setters(self):
        item = Item(24, 666)

        item.count = '44'
        item.price = '667'
        item.description = 'Foo bar'
        item.unit = 'hour'
        item.tax = '99.9'

        self.assertIsInstance(item.count, Decimal)
        self.assertEqual(item.count, 44)
        self.assertIsInstance(item.price, Decimal)
        self.assertEqual(item.price, 667)
        self.assertIsInstance(item.description, string_types)
        self.assertIsInstance(item.unit, string_types)
        self.assertIsInstance(item.tax, Decimal)
        self.assertEqual(item.tax, Decimal('99.9'))