Beispiel #1
0
class TestLightSensor(TestCase):
    def setUp(self):
        options = {"url": "http://www.gravatar.com/avatar/0?d=mm"}
        self.connection = Camera(options)
        self.camera = LightSensor(options, self.connection)

    def test_get_brightness(self):
        """
        Test that a value for the average
        brightness of the image is returned.
        """
        brightness = self.camera.get_brightness()
        self.assertTrue(brightness > 0)

    def tearDown(self):
        """
        Clean up by removing the test image that was downloaded.
        """
        if os.path.exists(self.connection.cache_directory):
            shutil.rmtree(self.connection.cache_directory)
class TestLightSensor(TestCase):

    def setUp(self):
        options = {
            "url": "http://www.gravatar.com/avatar/0?d=mm"
        }
        self.connection = Camera(options)
        self.camera = LightSensor(options, self.connection)

    def test_get_brightness(self):
        """
        Test that a value for the average
        brightness of the image is returned.
        """
        brightness = self.camera.get_brightness()
        self.assertTrue(brightness > 0)

    def tearDown(self):
        """
        Clean up by removing the test image that was downloaded.
        """
        if os.path.exists(self.connection.cache_directory):
            shutil.rmtree(self.connection.cache_directory)
 def setUp(self):
     options = {
         "url": "http://www.gravatar.com/avatar/0?d=mm"
     }
     self.connection = Camera(options)
     self.camera = LightSensor(options, self.connection)
Beispiel #4
0
 def setUp(self):
     options = {"url": "http://www.gravatar.com/avatar/0?d=mm"}
     self.connection = Camera(options)
     self.camera = LightSensor(options, self.connection)