Add initial tests
This commit is contained in:
12
tests/test_hand_recogniser.py
Normal file
12
tests/test_hand_recogniser.py
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
import unittest
|
||||||
|
from GestureRecognition.SimpleHandRecogniser import SimpleHandRecogniser
|
||||||
|
|
||||||
|
class TestSimpleHandRecogniser(unittest.TestCase):
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def setUp(self):
|
||||||
|
self.image_path = "H:\car\GestureRecognition\IMG_0818.png"
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
unittest.main()
|
||||||
22
tests/test_mqtt_voter.py
Normal file
22
tests/test_mqtt_voter.py
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
import unittest
|
||||||
|
from DecisionSystem.mqttvoter import MqttVoter
|
||||||
|
from DecisionSystem.vote import Vote
|
||||||
|
|
||||||
|
class TestMqttVoter(unittest.TestCase):
|
||||||
|
|
||||||
|
def test_vote_property(self):
|
||||||
|
self.assertTrue(self.voter.set_vote(Vote()))
|
||||||
|
self.assertEquals(self.voter.get_vote(), Vote())
|
||||||
|
|
||||||
|
def test_invalid_vote_set(self):
|
||||||
|
self.assertFalse(self.voter.set_vote("Hi"))
|
||||||
|
|
||||||
|
@unittest.skip
|
||||||
|
def test_submit_vote(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def setUp(self):
|
||||||
|
self.voter = MqttVoter()
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
unittest.main()
|
||||||
26
tests/test_vote.py
Normal file
26
tests/test_vote.py
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
import unittest
|
||||||
|
from DecisionSystem.vote import Vote
|
||||||
|
|
||||||
|
# Need to subclass unittest.TestCase to be a test case.
|
||||||
|
class Test_TestVoteMethods(unittest.TestCase):
|
||||||
|
|
||||||
|
# Test method dec. must start with test
|
||||||
|
def test_vote_default(self):
|
||||||
|
self.assertIs(self.vote.vote, None)
|
||||||
|
|
||||||
|
def test_vote_set(self):
|
||||||
|
self.vote.vote = "Hello"
|
||||||
|
self.assertEqual(self.vote.vote, "Hello")
|
||||||
|
|
||||||
|
def test_equal_default(self):
|
||||||
|
self.assertEqual(self.vote, Vote())
|
||||||
|
|
||||||
|
def test_equal_changed(self):
|
||||||
|
self.vote.vote = "Hi"
|
||||||
|
self.assertEqual(self.vote, Vote("Hi"))
|
||||||
|
|
||||||
|
def setUp(self):
|
||||||
|
self.vote = Vote()
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
unittest.main()
|
||||||
Reference in New Issue
Block a user