class TruckTestCase(unittest.TestCase):
    c = Truck(maker='Chevrolet',
              model='Silverado',
              year=2014,
              base_price=29000,
              miles=3000)  #example object
    d = Truck(maker='Chevrolet',
              model='Silverado',
              year=2004,
              base_price=16000,
              miles=52000)  #example object

    def test_truck_creation(self):
        self.assertEqual(TruckTestCase.c.maker, 'Chevrolet')
        self.assertEqual(TruckTestCase.c.model, 'Silverado')
        self.assertEqual(TruckTestCase.c.year, 2014)
        self.assertEqual(TruckTestCase.c.base_price, 29000)
        self.assertEqual(TruckTestCase.c.miles, 3000)

    def test_trucks_sale_price(self):
        self.assertEqual(TruckTestCase.c.sale_price(), 46400)
        self.assertEqual(TruckTestCase.d.sale_price(), 25600)

    def test_trucks_purchase_price(self):
        self.assertEqual(TruckTestCase.c.purchase_price(), 46340)
        self.assertEqual(TruckTestCase.d.purchase_price(), 24560)
def test_truck_creation():
    t = Truck(maker='Chevrolet', model='Silverado', year=2014,
              base_price=29000, miles=3000)

    assert t.maker == 'Chevrolet'
    assert t.model == 'Silverado'
    assert t.year == 2014
    assert t.base_price == 29000
    assert t.miles == 3000
    def setUp(self):
        self.car = Car(maker='Ford', model='Mustang', year=2005,
                       base_price=18000, miles=31000)

        self.truck = Truck(maker='Chevrolet', model='Silverado', year=2014,
                           base_price=29000, miles=3000)

        self.bike = Motorcycle(maker='Ducati', model='Monster',
                               year=2016, base_price=18000, miles=700)

        self.customer = Customer('John', 'Doe', '*****@*****.**')
        self.employee = Employee('Jane', 'Doe', '*****@*****.**')
    def test_truck_creation(self):
        t = Truck(maker='Chevrolet',
                  model='Silverado',
                  year=2014,
                  base_price=29000,
                  miles=3000)

        self.assertEqual(t.maker, 'Chevrolet')
        self.assertEqual(t.model, 'Silverado')
        self.assertEqual(t.year, 2014)
        self.assertEqual(t.base_price, 29000)
        self.assertEqual(t.miles, 3000)
def test_trucks_purchase_price():
    v1 = Truck(maker='Chevrolet', model='Silverado', year=2014,
               base_price=29000, miles=3000)
    v2 = Truck(maker='Chevrolet', model='Silverado', year=2004,
               base_price=16000, miles=52000)

    assert v1.purchase_price() == 46340
    assert v2.purchase_price() == 24560
    def test_trucks_purchase_price(self):
        v1 = Truck(maker='Chevrolet',
                   model='Silverado',
                   year=2014,
                   base_price=29000,
                   miles=3000)
        v2 = Truck(maker='Chevrolet',
                   model='Silverado',
                   year=2004,
                   base_price=16000,
                   miles=52000)

        self.assertEqual(v1.purchase_price(), 46340)
        self.assertEqual(v2.purchase_price(), 24560)
def fixtures():
    fix = Namespace()

    fix.car = Car(maker='Ford',
                  model='Mustang',
                  year=2005,
                  base_price=18000,
                  miles=31000)
    fix.truck = Truck(maker='Chevrolet',
                      model='Silverado',
                      year=2014,
                      base_price=29000,
                      miles=3000)
    fix.bike = Motorcycle(maker='Ducati',
                          model='Monster',
                          year=2016,
                          base_price=18000,
                          miles=700)

    fix.customer = Customer('John', 'Doe', '*****@*****.**')
    fix.employee = Employee('Jane', 'Doe', '*****@*****.**')
    return fix
Example #8
0
from pytest import approx

from dealership.contracts import BuyContract, LeaseContract
from dealership.customers import Customer, Employee
from dealership.vehicles import Car, Truck, Motorcycle

car = Car(maker='Ford',
          model='Mustang',
          year=2005,
          base_price=18000,
          miles=31000)

truck = Truck(maker='Chevrolet',
              model='Silverado',
              year=2014,
              base_price=29000,
              miles=3000)

bike = Motorcycle(maker='Ducati',
                  model='Monster',
                  year=2016,
                  base_price=18000,
                  miles=700)

customer = Customer('John', 'Doe', '*****@*****.**')
employee = Employee('Jane', 'Doe', '*****@*****.**')


def test_buy_contract_total_value_with_customer():
    car_contract = BuyContract(vehicle=car,
                               customer=customer,