Exemplo n.º 1
0
    def test_Gustometer_set_mode(self):
        self.g = Gustometer(use_threads=False, test_mode=True)

        self.g.set_mode('edit')
        assert self.g._mode == 'edit'

        self.g.set_mode('experiment')
        assert self.g._mode == 'experiment'

        self.g.set_mode('exp')
        assert self.g._mode == 'experiment'

        with pytest.raises(ValueError):
            self.g.set_mode('foobar')
Exemplo n.º 2
0
 def test_Gustometer_without_threads(self):
     self.g = Gustometer(use_threads=False, test_mode=True)
     self._test()
Exemplo n.º 3
0
class TestGustometer():
    def test_Gustometer_without_threads(self):
        self.g = Gustometer(use_threads=False, test_mode=True)
        self._test()

    def test_Gustometer_with_threads(self):
        self.g = Gustometer(use_threads=True, test_mode=True)
        self._test()

    def test_Gustometer_set_mode(self):
        self.g = Gustometer(use_threads=False, test_mode=True)

        self.g.set_mode('edit')
        assert self.g._mode == 'edit'

        self.g.set_mode('experiment')
        assert self.g._mode == 'experiment'

        self.g.set_mode('exp')
        assert self.g._mode == 'experiment'

        with pytest.raises(ValueError):
            self.g.set_mode('foobar')

    def _test(self):
        self.g.add_stimulus('Water', 0)
        self.g.select_stimulus('Water')
        self.g.stimulate()

    def teardown(self):
        del self.g