Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_reset_with_default(session):
channel = session.channels['0']
assert channel.aperture_time_units == nidcpower.ApertureTimeUnits.SECONDS
channel.aperture_time_units = nidcpower.ApertureTimeUnits.POWER_LINE_CYCLES
session.reset_with_defaults()
assert channel.aperture_time_units == nidcpower.ApertureTimeUnits.SECONDS
def test_config_aperture_time(single_channel_session):
expected_default_aperture_time = 0.01666
default_aperture_time = single_channel_session.aperture_time
assert single_channel_session.aperture_time_units == nidcpower.ApertureTimeUnits.SECONDS
default_aperture_time_in_range = abs(default_aperture_time - expected_default_aperture_time) <= max(1e-09 * max(abs(default_aperture_time), abs(expected_default_aperture_time)), 0.0) # https://stackoverflow.com/questions/5595425/what-is-the-best-way-to-compare-floats-for-almost-equality-in-python
assert default_aperture_time_in_range is True
single_channel_session.configure_aperture_time(5, nidcpower.ApertureTimeUnits.POWER_LINE_CYCLES)
assert single_channel_session.aperture_time_units == nidcpower.ApertureTimeUnits.POWER_LINE_CYCLES
aperture_time = single_channel_session.aperture_time
expected_aperture_time = 5
aperture_time_in_range = abs(aperture_time - expected_aperture_time) <= max(1e-09 * max(abs(aperture_time), abs(expected_aperture_time)), 0.0) # https://stackoverflow.com/questions/5595425/what-is-the-best-way-to-compare-floats-for-almost-equality-in-python
assert aperture_time_in_range is True
def test_config_aperture_time(single_channel_session):
expected_default_aperture_time = 0.01666
default_aperture_time = single_channel_session.aperture_time
assert single_channel_session.aperture_time_units == nidcpower.ApertureTimeUnits.SECONDS
default_aperture_time_in_range = abs(default_aperture_time - expected_default_aperture_time) <= max(1e-09 * max(abs(default_aperture_time), abs(expected_default_aperture_time)), 0.0) # https://stackoverflow.com/questions/5595425/what-is-the-best-way-to-compare-floats-for-almost-equality-in-python
assert default_aperture_time_in_range is True
single_channel_session.configure_aperture_time(5, nidcpower.ApertureTimeUnits.POWER_LINE_CYCLES)
assert single_channel_session.aperture_time_units == nidcpower.ApertureTimeUnits.POWER_LINE_CYCLES
aperture_time = single_channel_session.aperture_time
expected_aperture_time = 5
aperture_time_in_range = abs(aperture_time - expected_aperture_time) <= max(1e-09 * max(abs(aperture_time), abs(expected_aperture_time)), 0.0) # https://stackoverflow.com/questions/5595425/what-is-the-best-way-to-compare-floats-for-almost-equality-in-python
assert aperture_time_in_range is True