# Path: greenpithumb/wiring_config_parser.py
# class Error(Exception):
# class InvalidConfigError(Error):
# class IllegalGpioPinNumberError(Error):
# class IllegalAdcChannelError(Error):
# class DuplicateGpioPinNumberError(Error):
# class DuplicateAdcChannelError(Error):
# class _AdcChannelConfig(object):
# class _WiringConfig(object):
# def _validate_gpio_pin_config(gpio_config):
#     def __init__(self, soil_moisture_sensor, light_sensor):
#     def soil_moisture_sensor(self):
#     def light_sensor(self):
# def _validate_adc_channel_config(adc_config):
#     def __init__(self, gpio_pin_config, adc_channel_config):
#     def gpio_pins(self):
#     def adc_channels(self):
# def _parse_gpio_pin(pin_raw):
# def _parse_adc_channel(channel_raw):
# def parse(config_data):


import unittest
from greenpithumb import wiring_config_parser

# illegal: re-uses pin from pump
mcp3008_cs_shdn: 26

[adc_channels]
soil_moisture_sensor: 0
light_sensor: 6
""")

    def test_rejects_too_low_adc_channel(self):
        with self.assertRaises(wiring_config_parser.IllegalAdcChannelError):
            wiring_config_parser.parse("""
[gpio_pins]
pump: 26
dht11: 21
soil_moisture: 16
mcp3008_clk: 18
mcp3008_dout: 23
mcp3008_din: 24
mcp3008_cs_shdn: 25

[adc_channels]
light_sensor: 6

# illegal: ADC channels are from 0 to 7
soil_moisture_sensor: -1
""")

    def test_rejects_too_high_adc_channel(self):
        with self.assertRaises(wiring_config_parser.IllegalAdcChannelError):

# Path: greenpithumb/wiring_config_parser.py
# class Error(Exception):
# class InvalidConfigError(Error):
# class IllegalGpioPinNumberError(Error):
# class IllegalAdcChannelError(Error):
# class DuplicateGpioPinNumberError(Error):
# class DuplicateAdcChannelError(Error):
# class _AdcChannelConfig(object):
# class _WiringConfig(object):
# def _validate_gpio_pin_config(gpio_config):
#     def __init__(self, soil_moisture_sensor, light_sensor):
#     def soil_moisture_sensor(self):
#     def light_sensor(self):
# def _validate_adc_channel_config(adc_config):
#     def __init__(self, gpio_pin_config, adc_channel_config):
#     def gpio_pins(self):
#     def adc_channels(self):
# def _parse_gpio_pin(pin_raw):
# def _parse_adc_channel(channel_raw):
# def parse(config_data):


# Path: tests/test_wiring_config_parser.py
import unittest
from greenpithumb import wiring_config_parser


# illegal: re-uses pin from pump
mcp3008_cs_shdn: 26

[adc_channels]
soil_moisture_sensor: 0
light_sensor: 6
""")

    def test_rejects_too_low_adc_channel(self):
        with self.assertRaises(wiring_config_parser.IllegalAdcChannelError):
            wiring_config_parser.parse("""
[gpio_pins]
pump: 26
dht11: 21
soil_moisture: 16
mcp3008_clk: 18
mcp3008_dout: 23
mcp3008_din: 24
mcp3008_cs_shdn: 25

[adc_channels]
light_sensor: 6

# illegal: ADC channels are from 0 to 7
soil_moisture_sensor: -1
""")

    def test_rejects_too_high_adc_channel(self):
        with self.assertRaises(wiring_config_parser.IllegalAdcChannelError):

            wiring_config_parser.parse("""