# Path: pymoku/instruments.py

# 
# Path: pymoku/_datalogger.py
# REG_DL_OUTSEL = 64
# REG_DL_ACTL = 66
# REG_DL_DECIMATION = 65
# _DL_SOURCE_ADC1 = 0
# _DL_SOURCE_ADC2 = 1
# _DL_SOURCE_DAC1 = 2
# _DL_SOURCE_DAC2 = 3
# _DL_SOURCE_EXT = 4
# _DL_LB_ROUND = 0
# _DL_LB_CLIP = 1
# _DL_AIN_DDS = 0
# _DL_AIN_DECI = 1
# _DL_ADC_SMPS = ADC_SMP_RATE
# _DL_BUFLEN = CHN_BUFLEN
# _DL_SCREEN_WIDTH = 1024
# _DL_ROLL = ROLL
# _DL_SAMPLERATE_MIN = 10             # Smp/s
# _DL_SAMPLERATE_MAX = _DL_ADC_SMPS   # 500MSmp/s
# class Datalogger(_stream_instrument.StreamBasedInstrument,
#                  _waveform_generator.BasicWaveformGenerator):
#     def __init__(self):
#     def set_defaults(self):
#     def set_samplerate(self, samplerate):
#     def get_samplerate(self):
#     def set_precision_mode(self, state):
#     def is_precision_mode(self):
#     def set_source(self, ch, source, lmode='round'):
#     def _update_datalogger_params(self):
#     def _on_reg_sync(self):
#     def _get_hdrstr(self, ch1, ch2):
#     def _get_fmtstr(self, ch1, ch2):
#     def _deci_gain(self):
#     def _calculate_scales(self):
#         def _compute_total_scaling_factor(adc, dac, src, lmode):


import pytest
from pymoku.instruments import Datalogger
from pymoku import _datalogger
    from unittest.mock import patch, ANY
    from mock import patch, ANY

def test_set_precision_mode(dut, moku):
    '''
    TODO Default test
    '''
    dut.set_precision_mode(True)
    dut.is_precision_mode()
    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_source(dut, moku):
    '''
    TODO Default test
    '''
    dut.set_source(1, 'in1')
    moku._write_regs.assert_called_with(ANY)


@pytest.mark.parametrize('attr, value', [
    ('source_ch1', _datalogger._DL_SOURCE_ADC1),
    ('source_ch2', _datalogger._DL_SOURCE_ADC2),
    ('loopback_mode_ch1', _datalogger._DL_LB_CLIP),

# Path: pymoku/instruments.py

# 
# Path: pymoku/_datalogger.py
# REG_DL_OUTSEL = 64
# REG_DL_ACTL = 66
# REG_DL_DECIMATION = 65
# _DL_SOURCE_ADC1 = 0
# _DL_SOURCE_ADC2 = 1
# _DL_SOURCE_DAC1 = 2
# _DL_SOURCE_DAC2 = 3
# _DL_SOURCE_EXT = 4
# _DL_LB_ROUND = 0
# _DL_LB_CLIP = 1
# _DL_AIN_DDS = 0
# _DL_AIN_DECI = 1
# _DL_ADC_SMPS = ADC_SMP_RATE
# _DL_BUFLEN = CHN_BUFLEN
# _DL_SCREEN_WIDTH = 1024
# _DL_ROLL = ROLL
# _DL_SAMPLERATE_MIN = 10             # Smp/s
# _DL_SAMPLERATE_MAX = _DL_ADC_SMPS   # 500MSmp/s
# class Datalogger(_stream_instrument.StreamBasedInstrument,
#                  _waveform_generator.BasicWaveformGenerator):
#     def __init__(self):
#     def set_defaults(self):
#     def set_samplerate(self, samplerate):
#     def get_samplerate(self):
#     def set_precision_mode(self, state):
#     def is_precision_mode(self):
#     def set_source(self, ch, source, lmode='round'):
#     def _update_datalogger_params(self):
#     def _on_reg_sync(self):
#     def _get_hdrstr(self, ch1, ch2):
#     def _get_fmtstr(self, ch1, ch2):
#     def _deci_gain(self):
#     def _calculate_scales(self):
#         def _compute_total_scaling_factor(adc, dac, src, lmode):


# Path: tests/test_datalogger.py
import pytest
from pymoku.instruments import Datalogger
from pymoku import _datalogger
    from unittest.mock import patch, ANY
    from mock import patch, ANY


def test_set_precision_mode(dut, moku):
    '''
    TODO Default test
    '''
    dut.set_precision_mode(True)
    dut.is_precision_mode()
    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_source(dut, moku):
    '''
    TODO Default test
    '''
    dut.set_source(1, 'in1')
    moku._write_regs.assert_called_with(ANY)


@pytest.mark.parametrize('attr, value', [
    ('source_ch1', _datalogger._DL_SOURCE_ADC1),
    ('source_ch2', _datalogger._DL_SOURCE_ADC2),
    ('loopback_mode_ch1', _datalogger._DL_LB_CLIP),

    ('loopback_mode_ch2', _datalogger._DL_LB_ROUND),