# Path: greenpithumb/light_sensor.py
# _LIGHT_SENSOR_MIN_VALUE = 0
# _LIGHT_SENSOR_MAX_VALUE = 1023
# class Error(Exception):
# class LightSensorLowError(Error):
# class LightSensor(object):
#     def __init__(self, adc, channel):
#     def light(self):


import unittest
import mock
from greenpithumb import light_sensor




class LightSensorTest(unittest.TestCase):

    def setUp(self):
        self.mock_adc = mock.Mock()
        channel = 1
        self.light_sensor = light_sensor.LightSensor(self.mock_adc, channel)

    def test_light_50_pct(self):
        """Near midpoint light sensor value should return near 50."""
        self.mock_adc.read_adc.return_value = 511

# Path: greenpithumb/light_sensor.py
# _LIGHT_SENSOR_MIN_VALUE = 0
# _LIGHT_SENSOR_MAX_VALUE = 1023
# class Error(Exception):
# class LightSensorLowError(Error):
# class LightSensor(object):
#     def __init__(self, adc, channel):
#     def light(self):


# Path: tests/test_light_sensor.py
import unittest
import mock
from greenpithumb import light_sensor





class LightSensorTest(unittest.TestCase):

    def setUp(self):
        self.mock_adc = mock.Mock()
        channel = 1
        self.light_sensor = light_sensor.LightSensor(self.mock_adc, channel)

    def test_light_50_pct(self):
        """Near midpoint light sensor value should return near 50."""
        self.mock_adc.read_adc.return_value = 511

        self.assertAlmostEqual(self.light_sensor.light(), 50.0, places=1)