def setUp(self): self.turbine = TurbineCostAdder() self.turbine.offshore = True self.turbine.rotor_cost = 1519510.91 self.turbine.nacelle_cost = 3043115.22 self.turbine.tower_cost = 1031523.34
def test1(self): turbine = TurbineCostAdder() turbine.offshore = True turbine.rotor_cost = 2000000.0 turbine.nacelle_cost = 5000000.0 turbine.tower_cost = 1000000.0 check_gradient_unit_test(self, turbine)
class TestTurbineCostAdder(unittest.TestCase): def setUp(self): self.turbine = TurbineCostAdder() self.turbine.offshore = True self.turbine.rotor_cost = 1519510.91 self.turbine.nacelle_cost = 3043115.22 self.turbine.tower_cost = 1031523.34 def test_functionality(self): self.turbine.run() self.assertEqual(round(self.turbine.turbine_cost,2), 6153564.42) def test_gradient(self): check_gradient_unit_test(self, self.turbine)