コード例 #1
0
ファイル: mav_recharging_test.py プロジェクト: nw341/mav
    def test_2(self):
        e = Electrode()
        assert e.acquire()
        assert not e.acquire(False)

        # After releasing the lock, it should be able to be acquired again.
        e.release()
        assert e.acquire()
コード例 #2
0
ファイル: mav_recharging_test.py プロジェクト: nw341/mav
 def test_3(self):
     e = Electrode()
     with e:
         assert not e.acquire(False)
     assert e.acquire()
コード例 #3
0
ファイル: mav_recharging_test.py プロジェクト: nw341/mav
 def test_1(self):
     e = Electrode()
     # Releasing an electrode that's unlocked should raise a ThreadError, just as `releasing a Lock <https://docs.python.org/2/library/threading.html#threading.Lock.release>`_ does. See `pytest.raises <https://pytest.org/latest/assert.html#assertions-about-expected-exceptions>`_.
     with pytest.raises(ThreadError):
         e.release()