# Path: pymoku/instruments.py

# 
# Path: pymoku/_oscilloscope.py
# REG_OSC_OUTSEL = 64
# REG_OSC_TRIGCTL = 67
# REG_OSC_ACTL = 66
# REG_OSC_DECIMATION = 65
# REG_OSC_AUTOTIMER = 74
# _OSC_SOURCE_CH1 = 0
# _OSC_SOURCE_CH2 = 1
# _OSC_SOURCE_DA1 = 2
# _OSC_SOURCE_DA2 = 3
# _OSC_SOURCE_EXT = 4
# _OSC_SOURCES = {
#     'in1': _OSC_SOURCE_CH1,
#     'in2': _OSC_SOURCE_CH2,
#     'out1': _OSC_SOURCE_DA1,
#     'out2': _OSC_SOURCE_DA2,
#     'ext': _OSC_SOURCE_EXT
# }
# _OSC_ROLL = ROLL
# _OSC_SWEEP = SWEEP
# _OSC_FULL_FRAME = FULL_FRAME
# _OSC_LB_ROUND = 0
# _OSC_LB_CLIP = 1
# _OSC_AIN_DDS = 0
# _OSC_AIN_DECI = 1
# _OSC_ADC_SMPS = ADC_SMP_RATE
# _OSC_BUFLEN = CHN_BUFLEN
# _OSC_TRIGLVL_MAX = 10.0  # V
# _OSC_TRIGLVL_MIN = -10.0  # V
# _OSC_SAMPLERATE_MIN = 10  # smp/s
# _OSC_SAMPLERATE_MAX = 500e6  # smp/s
# _OSC_PRETRIGGER_MAX = (2**12) - 1
# _OSC_POSTTRIGGER_MAX = -2**28
# _CLK_FREQ = 125e6
# _TIMER_ACCUM = 2.0**32
# class _CoreOscilloscope(_frame_instrument.FrameBasedInstrument):
# class Oscilloscope(
#         _CoreOscilloscope, _waveform_generator.BasicWaveformGenerator):
#     def __init__(self):
#     def _calculate_decimation(self, t1, t2):
#     def _calculate_render_downsample(self, t1, t2, decimation):
#         def _cubic_int_to_scale(integer):
#     def _calculate_buffer_offset(self, t1, decimation):
#     def _calculate_render_offset(self, t1, decimation):
#     def _calculate_frame_start_time(self, decimation,
#                                     render_decimation, frame_offset):
#     def _calculate_frame_timestep(self, decimation, render_decimation):
#     def _calculate_buffer_timestep(self, decimation):
#     def _calculate_buffer_start_time(self, decimation, buffer_offset):
#     def _deci_gain(self):
#     def set_timebase(self, t1, t2):
#     def set_samplerate(self, samplerate, trigger_offset=0):
#     def get_samplerate(self):
#     def set_xmode(self, xmode):
#     def set_precision_mode(self, state):
#     def is_precision_mode(self):
#     def _set_trigger(self, source, edge, level, minwidth, maxwidth,
#                      hysteresis, hf_reject, mode):
#     def _set_source(self, ch, source):
#     def set_defaults(self):
#     def _calculate_scales(self):
#     def _update_dependent_regs(self, scales):
#     def _update_datalogger_params(self):
#     def _get_hdrstr(self, ch1, ch2):
#     def _get_fmtstr(self, ch1, ch2):
#     def _on_reg_sync(self):
#     def commit(self):
#     def set_defaults(self):
#     def set_trigger(self, source, edge, level, minwidth=None, maxwidth=None,
#                     hysteresis=10e-3, hf_reject=False, mode='auto'):
#     def set_source(self, ch, source, lmode='round'):
#     def _signal_source_volts_per_bit(self, source, scales, trigger=False):


import pytest
from pymoku.instruments import Oscilloscope
from pymoku import _oscilloscope
    from unittest.mock import patch, ANY
    from mock import patch, ANY
    moku._write_regs.assert_called_with(ANY)


def test_set_defaults(dut, moku):
    '''
    TODO Default test
    '''
    dut.set_defaults()
    moku._write_regs.assert_called_with(ANY)


def test_set_trigger(dut, moku):
    '''
    TODO Default test
    '''
    dut.set_trigger('in1', 'rising', 0.0)
    moku._write_regs.assert_called_with(ANY)


def test_set_source(dut, moku):
    '''
    TODO Default test
    '''
    dut.set_source(1, 'in1', 0.0)
    moku._write_regs.assert_called_with(ANY)


@pytest.mark.parametrize('attr, value', [
    ('source_ch1', _oscilloscope._OSC_SOURCE_CH1),
    ('source_ch2', _oscilloscope._OSC_SOURCE_CH1),

# Path: pymoku/instruments.py

# 
# Path: pymoku/_oscilloscope.py
# REG_OSC_OUTSEL = 64
# REG_OSC_TRIGCTL = 67
# REG_OSC_ACTL = 66
# REG_OSC_DECIMATION = 65
# REG_OSC_AUTOTIMER = 74
# _OSC_SOURCE_CH1 = 0
# _OSC_SOURCE_CH2 = 1
# _OSC_SOURCE_DA1 = 2
# _OSC_SOURCE_DA2 = 3
# _OSC_SOURCE_EXT = 4
# _OSC_SOURCES = {
#     'in1': _OSC_SOURCE_CH1,
#     'in2': _OSC_SOURCE_CH2,
#     'out1': _OSC_SOURCE_DA1,
#     'out2': _OSC_SOURCE_DA2,
#     'ext': _OSC_SOURCE_EXT
# }
# _OSC_ROLL = ROLL
# _OSC_SWEEP = SWEEP
# _OSC_FULL_FRAME = FULL_FRAME
# _OSC_LB_ROUND = 0
# _OSC_LB_CLIP = 1
# _OSC_AIN_DDS = 0
# _OSC_AIN_DECI = 1
# _OSC_ADC_SMPS = ADC_SMP_RATE
# _OSC_BUFLEN = CHN_BUFLEN
# _OSC_TRIGLVL_MAX = 10.0  # V
# _OSC_TRIGLVL_MIN = -10.0  # V
# _OSC_SAMPLERATE_MIN = 10  # smp/s
# _OSC_SAMPLERATE_MAX = 500e6  # smp/s
# _OSC_PRETRIGGER_MAX = (2**12) - 1
# _OSC_POSTTRIGGER_MAX = -2**28
# _CLK_FREQ = 125e6
# _TIMER_ACCUM = 2.0**32
# class _CoreOscilloscope(_frame_instrument.FrameBasedInstrument):
# class Oscilloscope(
#         _CoreOscilloscope, _waveform_generator.BasicWaveformGenerator):
#     def __init__(self):
#     def _calculate_decimation(self, t1, t2):
#     def _calculate_render_downsample(self, t1, t2, decimation):
#         def _cubic_int_to_scale(integer):
#     def _calculate_buffer_offset(self, t1, decimation):
#     def _calculate_render_offset(self, t1, decimation):
#     def _calculate_frame_start_time(self, decimation,
#                                     render_decimation, frame_offset):
#     def _calculate_frame_timestep(self, decimation, render_decimation):
#     def _calculate_buffer_timestep(self, decimation):
#     def _calculate_buffer_start_time(self, decimation, buffer_offset):
#     def _deci_gain(self):
#     def set_timebase(self, t1, t2):
#     def set_samplerate(self, samplerate, trigger_offset=0):
#     def get_samplerate(self):
#     def set_xmode(self, xmode):
#     def set_precision_mode(self, state):
#     def is_precision_mode(self):
#     def _set_trigger(self, source, edge, level, minwidth, maxwidth,
#                      hysteresis, hf_reject, mode):
#     def _set_source(self, ch, source):
#     def set_defaults(self):
#     def _calculate_scales(self):
#     def _update_dependent_regs(self, scales):
#     def _update_datalogger_params(self):
#     def _get_hdrstr(self, ch1, ch2):
#     def _get_fmtstr(self, ch1, ch2):
#     def _on_reg_sync(self):
#     def commit(self):
#     def set_defaults(self):
#     def set_trigger(self, source, edge, level, minwidth=None, maxwidth=None,
#                     hysteresis=10e-3, hf_reject=False, mode='auto'):
#     def set_source(self, ch, source, lmode='round'):
#     def _signal_source_volts_per_bit(self, source, scales, trigger=False):


# Path: tests/test_oscilloscope.py
import pytest
from pymoku.instruments import Oscilloscope
from pymoku import _oscilloscope
    from unittest.mock import patch, ANY
    from mock import patch, ANY

    moku._write_regs.assert_called_with(ANY)


def test_set_defaults(dut, moku):
    '''
    TODO Default test
    '''
    dut.set_defaults()
    moku._write_regs.assert_called_with(ANY)


def test_set_trigger(dut, moku):
    '''
    TODO Default test
    '''
    dut.set_trigger('in1', 'rising', 0.0)
    moku._write_regs.assert_called_with(ANY)


def test_set_source(dut, moku):
    '''
    TODO Default test
    '''
    dut.set_source(1, 'in1', 0.0)
    moku._write_regs.assert_called_with(ANY)


@pytest.mark.parametrize('attr, value', [
    ('source_ch1', _oscilloscope._OSC_SOURCE_CH1),
    ('source_ch2', _oscilloscope._OSC_SOURCE_CH1),

    ('trig_ch', _oscilloscope._OSC_SOURCE_CH1),