Skip to content

Commit

Permalink
MRG: Merge pull request #7 from AndreaBlengino/dev
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreaBlengino authored Mar 17, 2024
2 parents 6ceb735 + 6391589 commit f84d076
Show file tree
Hide file tree
Showing 33 changed files with 188 additions and 188 deletions.
2 changes: 1 addition & 1 deletion docs/source/examples/1_simple_powertrain/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
### System in Analysis

The complete example code is available
[here](https://github.com/AndreaBlengino/gearpy/blob/master/docs/source/examples/1_simple_transmission_chain/simple_transmission_chain.py).
[here](https://github.com/AndreaBlengino/gearpy/blob/master/docs/source/examples/1_simple_powertrain/simple_powertrain.py).
The mechanical powertrain to be studied is reported in the image below:

![](images/scheme.png)
Expand Down
8 changes: 4 additions & 4 deletions tests/test_mechanical_objects/test_dc_motor/test_dc_motor.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class TestDCMotorInit:
inertia_moment = inertia_moments(),
no_load_speed = angular_speeds(min_value = 1, max_value = 1000),
maximum_torque = torques(min_value = 1, max_value = 10))
@settings(max_examples = 100)
@settings(max_examples = 100, deadline = None)
def test_method(self, name, inertia_moment, no_load_speed, maximum_torque):
motor = DCMotor(name = name, inertia_moment = inertia_moment, no_load_speed = no_load_speed, maximum_torque = maximum_torque)

Expand Down Expand Up @@ -72,7 +72,7 @@ class TestDCMotorComputeTorque:
maximum_electric_current = currents(min_value = 5, max_value = 10, unit = 'A'),
speed = angular_speeds(),
electric_motor = booleans())
@settings(max_examples = 100)
@settings(max_examples = 100, deadline = None)
def test_method(self, name, inertia_moment, no_load_speed, maximum_torque, no_load_electric_current,
maximum_electric_current, speed, electric_motor):
if electric_motor:
Expand Down Expand Up @@ -102,7 +102,7 @@ class TestDCMotorComputeElectricCurrent:
no_load_electric_current = currents(min_value = 0, max_value = 0.1, unit = 'A'),
maximum_electric_current = currents(min_value = 0.2, max_value = 10, unit = 'A'),
driving_torque = torques())
@settings(max_examples = 100)
@settings(max_examples = 100, deadline = None)
def test_method(self, name, inertia_moment, no_load_speed, maximum_torque, no_load_electric_current,
maximum_electric_current, driving_torque):
motor = DCMotor(name = name, inertia_moment = inertia_moment, no_load_speed = no_load_speed,
Expand Down Expand Up @@ -153,7 +153,7 @@ class TestDCMotorPWM:

@mark.genuine
@given(pwm = floats(allow_nan = False, allow_infinity = False, min_value = -1, max_value = 1))
@settings(max_examples = 100)
@settings(max_examples = 100, deadline = None)
def test_property(self, pwm):
basic_dc_motor_1.pwm = pwm

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class TestFlywheelInit:
@mark.genuine
@given(name = text(min_size = 1),
inertia_moment = inertia_moments())
@settings(max_examples = 100)
@settings(max_examples = 100, deadline = None)
def test_method(self, name, inertia_moment):
flywheel = Flywheel(name = name, inertia_moment = inertia_moment)

Expand Down
2 changes: 1 addition & 1 deletion tests/test_mechanical_objects/test_gear/test_gear.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ class TestSpurExternalTorque:
@mark.genuine
@given(external_torque = functions(like = lambda angular_position, angular_speed, time: Torque(1, 'Nm'),
returns = torques()))
@settings(max_examples = 100)
@settings(max_examples = 100, deadline = None)
def test_property(self, external_torque):
for gear in basic_gears:
gear.external_torque = external_torque
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class TestHelicalGearInit:
module_value = floats(allow_nan = False, allow_infinity = False, min_value = 0.1, max_value = 10),
face_width_value = floats(allow_nan = False, allow_infinity = False, min_value = 0.1, max_value = 100),
elastic_modulus_value = floats(allow_nan = False, allow_infinity = False, min_value = 0.1, max_value = 10))
@settings(max_examples = 100)
@settings(max_examples = 100, deadline = None)
def test_method(self, name, n_teeth, helix_angle, inertia_moment, module_value, face_width_value, elastic_modulus_value):
module = Length(module_value, 'mm')
face_width = Length(face_width_value, 'mm')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class TestRotatingObjectAngularPosition:

@mark.genuine
@given(angular_position = angular_positions())
@settings(max_examples = 100)
@settings(max_examples = 100, deadline = None)
def test_property(self, angular_position):
for rotating_object in basic_rotating_objects:
rotating_object.angular_position = angular_position
Expand All @@ -38,7 +38,7 @@ class TestRotatingObjectAngularSpeed:

@mark.genuine
@given(angular_speed = angular_speeds())
@settings(max_examples = 100)
@settings(max_examples = 100, deadline = None)
def test_property(self, angular_speed):
for rotating_object in basic_rotating_objects:
rotating_object.angular_speed = angular_speed
Expand All @@ -59,7 +59,7 @@ class TestRotatingObjectAngularAcceleration:

@mark.genuine
@given(angular_acceleration = angular_accelerations())
@settings(max_examples = 100)
@settings(max_examples = 100, deadline = None)
def test_property(self, angular_acceleration):
for rotating_object in basic_rotating_objects:
rotating_object.angular_acceleration = angular_acceleration
Expand All @@ -80,7 +80,7 @@ class TestRotatingObjectTorque:

@mark.genuine
@given(torque = torques())
@settings(max_examples = 100)
@settings(max_examples = 100, deadline = None)
def test_property(self, torque):
for rotating_object in basic_rotating_objects:
rotating_object.torque = torque
Expand All @@ -101,7 +101,7 @@ class TestRotatingObjectDrivingTorque:

@mark.genuine
@given(driving_torque = torques())
@settings(max_examples = 100)
@settings(max_examples = 100, deadline = None)
def test_property(self, driving_torque):
for rotating_object in basic_rotating_objects:
rotating_object.driving_torque = driving_torque
Expand All @@ -122,7 +122,7 @@ class TestRotatingObjectLoadTorque:

@mark.genuine
@given(load_torque = torques())
@settings(max_examples = 100)
@settings(max_examples = 100, deadline = None)
def test_property(self, load_torque):
for rotating_object in basic_rotating_objects:
rotating_object.load_torque = load_torque
Expand Down
8 changes: 4 additions & 4 deletions tests/test_mechanical_objects/test_slave/test_slave.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class TestSlaveDrivenBy:

@mark.genuine
@given(master_rotating_object = rotating_objects())
@settings(max_examples = 100)
@settings(max_examples = 100, deadline = None)
def test_property(self, master_rotating_object):
for slave in basic_slaves:
slave.driven_by = master_rotating_object
Expand All @@ -33,7 +33,7 @@ class TestSlaveDrives:

@mark.genuine
@given(slave_rotating_object = rotating_objects())
@settings(max_examples = 100)
@settings(max_examples = 100, deadline = None)
def test_property(self, slave_rotating_object):
for slave in basic_slaves:
slave.drives = slave_rotating_object
Expand All @@ -54,7 +54,7 @@ class TestSlaveMasterGearRatio:

@mark.genuine
@given(master_gear_ratio = floats(allow_nan = False, allow_infinity = False, min_value = 0, exclude_min = True))
@settings(max_examples = 100)
@settings(max_examples = 100, deadline = None)
def test_property(self, master_gear_ratio):
for slave in basic_slaves:
slave.master_gear_ratio = master_gear_ratio
Expand Down Expand Up @@ -83,7 +83,7 @@ class TestSlaveMasterGearEfficiency:
@mark.genuine
@given(master_gear_efficiency = floats(allow_nan = False, allow_infinity = False,
min_value = 0, exclude_min = False, max_value = 1, exclude_max = False))
@settings(max_examples = 100)
@settings(max_examples = 100, deadline = None)
def test_property(self, master_gear_efficiency):
for slave in basic_slaves:
if not isinstance(slave, Flywheel):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class TestSpurGearInit:
module_value = floats(allow_nan = False, allow_infinity = False, min_value = 0.1, max_value = 10),
face_width_value = floats(allow_nan = False, allow_infinity = False, min_value = 0.1, max_value = 100),
elastic_modulus_value = floats(allow_nan = False, allow_infinity = False, min_value = 0.1, max_value = 10))
@settings(max_examples = 100)
@settings(max_examples = 100, deadline = None)
def test_method(self, name, n_teeth, inertia_moment, module_value, face_width_value, elastic_modulus_value):
module = Length(module_value, 'mm')
face_width = Length(face_width_value, 'mm')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class TestWormGearInit:
pressure_angle = sampled_from(elements = WORM_GEAR_AND_WHEEL_AVAILABLE_PRESSURE_ANGLES),
helix_angle_value = floats(allow_nan = False, allow_infinity = False, min_value = 0.1, max_value = 15),
reference_diameter_value = floats(allow_nan = False, allow_infinity = False, min_value = 0.1, max_value = 10))
@settings(max_examples = 100)
@settings(max_examples = 100, deadline = None)
def test_method(self, name, n_starts, inertia_moment, pressure_angle, helix_angle_value, reference_diameter_value):
helix_angle = Angle(helix_angle_value, 'deg')
reference_diameter = Length(reference_diameter_value, 'mm')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class TestWormWheelInit:
helix_angle_value = floats(allow_nan = False, allow_infinity = False, min_value = 0.1, max_value = 15),
module_value = floats(allow_nan = False, allow_infinity = False, min_value = 0.1, max_value = 10),
face_width_value = floats(allow_nan = False, allow_infinity = False, min_value = 0.1, max_value = 100))
@settings(max_examples = 100)
@settings(max_examples = 100, deadline = None)
def test_method(self, name, n_teeth, inertia_moment, pressure_angle, helix_angle_value, module_value, face_width_value):
helix_angle = Angle(helix_angle_value, 'deg')
module = Length(module_value, 'mm')
Expand Down
6 changes: 3 additions & 3 deletions tests/test_motor_control/test_pwm_control/test_pwm_control.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class TestPWMControlInit:

@mark.genuine
@given(powertrain = powertrains())
@settings(max_examples = 100, suppress_health_check = [HealthCheck.too_slow])
@settings(max_examples = 100, deadline = None, suppress_health_check = [HealthCheck.too_slow])
def test_method(self, powertrain):
motor_control = PWMControl(powertrain = powertrain)

Expand Down Expand Up @@ -57,7 +57,7 @@ class TestPWMControlAddRule:
limit_electric_current = currents(min_value = 10, max_value = 15, unit = 'A'),
element_index = integers(min_value = 0),
use_limit_current_rule = booleans())
@settings(max_examples = 100, suppress_health_check = [HealthCheck.too_slow])
@settings(max_examples = 100, deadline = None, suppress_health_check = [HealthCheck.too_slow])
def test_method(self, powertrain, start_target_angular_position, reach_target_angular_position,
pwm_min_multiplier, pwm_min, braking_angle, limit_electric_current, element_index, use_limit_current_rule):
element_index %= len(powertrain.elements)
Expand Down Expand Up @@ -107,7 +107,7 @@ class TestPWMControlApplyRules:
use_limit_current_rule = booleans(),
current_angular_position = angular_positions(min_value = 0, max_value = 200_000, unit = 'rad'),
current_angular_speed = angular_speeds())
@settings(max_examples = 100, suppress_health_check = [HealthCheck.too_slow])
@settings(max_examples = 100, deadline = None, suppress_health_check = [HealthCheck.too_slow])
def test_method(self, powertrain, start_target_angular_position, reach_target_angular_position,
pwm_min_multiplier, pwm_min, braking_angle, limit_electric_current, element_index,
use_limit_current_rule, current_angular_position, current_angular_speed):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class TestConstantPWMInit:
@given(timer = timers(),
powertrain = powertrains(),
target_pwm_value = floats(allow_nan = False, allow_infinity = False, min_value = -1, max_value = 1))
@settings(max_examples = 100, suppress_health_check = [HealthCheck.too_slow])
@settings(max_examples = 100, deadline = None, suppress_health_check = [HealthCheck.too_slow])
def test_method(self, timer, powertrain, target_pwm_value):
rule = ConstantPWM(timer = timer, powertrain = powertrain, target_pwm_value = target_pwm_value)

Expand Down Expand Up @@ -45,7 +45,7 @@ class TestConstantPWMApply:
powertrain = powertrains(),
target_pwm_value = floats(allow_nan = False, allow_infinity = False, min_value = -1, max_value = 1),
current_time = times())
@settings(max_examples = 100, suppress_health_check = [HealthCheck.too_slow])
@settings(max_examples = 100, deadline = None, suppress_health_check = [HealthCheck.too_slow])
def test_method(self, timer, powertrain, target_pwm_value, current_time):
warnings.filterwarnings('ignore', category = RuntimeWarning)
rule = ConstantPWM(timer = timer, powertrain = powertrain, target_pwm_value = target_pwm_value)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class TestReachAngularPositionInit:
powertrain = powertrains(),
target_angular_position = angular_positions(),
braking_angle = angles())
@settings(max_examples = 100, suppress_health_check = [HealthCheck.too_slow])
@settings(max_examples = 100, deadline = None, suppress_health_check = [HealthCheck.too_slow])
def test_method(self, element_index, powertrain, target_angular_position, braking_angle):
element_index %= len(powertrain.elements)
encoder = AbsoluteRotaryEncoder(target = powertrain.elements[element_index])
Expand Down Expand Up @@ -56,7 +56,7 @@ class TestReachAngularPositionApply:
braking_angle_multiplier = floats(allow_nan = False, allow_infinity = False, min_value = 2, max_value = 1000),
target_angular_position_multiplier = floats(allow_nan = False, allow_infinity = False, min_value = 3, max_value = 1000),
available_load_torque = booleans())
@settings(max_examples = 100, suppress_health_check = [HealthCheck.too_slow])
@settings(max_examples = 100, deadline = None, suppress_health_check = [HealthCheck.too_slow])
def test_method(self, element_index, powertrain, current_angular_position, braking_angle_multiplier,
target_angular_position_multiplier, available_load_torque):
element_index %= len(powertrain.elements)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class TestStartLimitCurrentInit:
@given(motor = dc_motors(current = True),
target_angular_position = angular_positions(),
limit_electric_current = currents(min_value = 1, max_value = 10))
@settings(max_examples = 100, suppress_health_check = [HealthCheck.too_slow])
@settings(max_examples = 100, deadline = None, suppress_health_check = [HealthCheck.too_slow])
def test_method(self, motor, target_angular_position, limit_electric_current):
encoder = AbsoluteRotaryEncoder(target = motor)
tachometer = Tachometer(target = motor)
Expand Down Expand Up @@ -54,7 +54,7 @@ class TestStartLimitCurrentApply:
limit_electric_current = currents(min_value = 1, max_value = 10),
target_angular_position_multiplier = floats(allow_nan = False, allow_infinity = False, min_value = 2, max_value = 1000),
current_angular_speed = angular_speeds())
@settings(max_examples = 100, suppress_health_check = [HealthCheck.too_slow])
@settings(max_examples = 100, deadline = None, suppress_health_check = [HealthCheck.too_slow])
def test_method(self, motor, current_angular_position, limit_electric_current, target_angular_position_multiplier,
current_angular_speed):
warnings.filterwarnings('ignore', category = RuntimeWarning)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class TestStartProportionalToAngularPositionInit:
pwm_min_multiplier = floats(allow_nan = False, allow_infinity = False, min_value = 1, exclude_min = True, max_value = 1000),
pwm_min = one_of(floats(allow_nan = False, allow_infinity = False, min_value = 1e-10, exclude_min = True, max_value = 1),
none()))
@settings(max_examples = 100, suppress_health_check = [HealthCheck.too_slow])
@settings(max_examples = 100, deadline = None, suppress_health_check = [HealthCheck.too_slow])
def test_method(self, element_index, powertrain, target_angular_position, pwm_min_multiplier, pwm_min):
element_index %= len(powertrain.elements)
encoder = AbsoluteRotaryEncoder(target = powertrain.elements[element_index])
Expand Down Expand Up @@ -62,7 +62,7 @@ class TestStartProportionalToAngularPositionApply:
none()),
target_angular_position_multiplier = floats(allow_nan = False, allow_infinity = False, min_value = 2, max_value = 1000),
load_torque_time_variable = booleans())
@settings(max_examples = 100, suppress_health_check = [HealthCheck.too_slow])
@settings(max_examples = 100, deadline = None, suppress_health_check = [HealthCheck.too_slow])
def test_method(self, element_index, powertrain, current_angular_position, pwm_min_multiplier, pwm_min,
target_angular_position_multiplier, load_torque_time_variable):
if powertrain.elements[0].electric_current_is_computable:
Expand Down
2 changes: 1 addition & 1 deletion tests/test_powertrain/test_powertrain.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ class TestPowertrainUpdateTime:
@mark.genuine
@given(powertrain = powertrains(),
instant = times())
@settings(max_examples = 100, suppress_health_check = [HealthCheck.too_slow])
@settings(max_examples = 100, deadline = None, suppress_health_check = [HealthCheck.too_slow])
def test_method(self, powertrain, instant):
powertrain.update_time(instant = instant)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class TestAbsoluteRotaryEncoderInit:

@mark.genuine
@given(rotating_object = rotating_objects())
@settings(max_examples = 100)
@settings(max_examples = 100, deadline = None)
def test_method(self, rotating_object):
encoder = AbsoluteRotaryEncoder(target = rotating_object)

Expand All @@ -36,7 +36,7 @@ class TestAbsoluteRotaryEncoderTarget:

@mark.genuine
@given(rotating_object = rotating_objects())
@settings(max_examples = 100)
@settings(max_examples = 100, deadline = None)
def test_property(self, rotating_object):
encoder = AbsoluteRotaryEncoder(target = rotating_object)

Expand All @@ -51,7 +51,7 @@ class TestAbsoluteRotaryEncoderGetValue:
@given(angular_position = angular_positions(),
unit = one_of(sampled_from(elements = units_list),
none()))
@settings(max_examples = 100)
@settings(max_examples = 100, deadline = None)
def test_method(self, angular_position, unit):
gear = SpurGear(name = 'gear', n_teeth = 10, inertia_moment = InertiaMoment(1, 'kgm^2'))
gear.angular_position = angular_position
Expand Down
6 changes: 3 additions & 3 deletions tests/test_sensors/test_tachometer/test_tachometer.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class TestTachometerInit:

@mark.genuine
@given(rotating_object = rotating_objects())
@settings(max_examples = 100)
@settings(max_examples = 100, deadline = None)
def test_method(self, rotating_object):
tachometer = Tachometer(target = rotating_object)

Expand All @@ -36,7 +36,7 @@ class TestTachometerTarget:

@mark.genuine
@given(rotating_object = rotating_objects())
@settings(max_examples = 100)
@settings(max_examples = 100, deadline = None)
def test_property(self, rotating_object):
tachometer = Tachometer(target = rotating_object)

Expand All @@ -51,7 +51,7 @@ class TestTachometerGetValue:
@given(angular_speed = angular_speeds(),
unit = one_of(sampled_from(elements = units_list),
none()))
@settings(max_examples = 100)
@settings(max_examples = 100, deadline = None)
def test_method(self, angular_speed, unit):
gear = SpurGear(name = 'gear', n_teeth = 10, inertia_moment = InertiaMoment(1, 'kgm^2'))
gear.angular_speed = angular_speed
Expand Down
Loading

0 comments on commit f84d076

Please sign in to comment.