-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
INTU-1187 | Add unit test for the gesture class
- Loading branch information
Ravi Sinha
committed
Apr 12, 2017
1 parent
bb8ca8a
commit 4c5fd30
Showing
2 changed files
with
44 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
''' Unit test for the Gesture class ''' | ||
|
||
import unittest | ||
import sys | ||
sys.path.append('../') | ||
from self.gestures.gesture import Gesture | ||
|
||
class TestGesture(unittest.TestCase): | ||
''' A bunch of unit tests that test the basic functionality of the Gesture | ||
class ''' | ||
|
||
def test_get_instance(self): | ||
''' Verify that the object gets instantiated correctly with default | ||
values ''' | ||
test_gesture = Gesture(1, 2) | ||
self.assertEqual(test_gesture.get_gesture_id(), 1) | ||
self.assertEqual(test_gesture.get_instance_id(), 2) | ||
|
||
def test_gesture_id_sanity(self): | ||
''' Should not allow a blank or None gesture ID to go unnoticed ''' | ||
test_gesture = Gesture(None, 2) | ||
with self.assertRaises(Exception): | ||
test_gesture.get_gesture_id() | ||
|
||
test_gesture = Gesture('', 2) | ||
with self.assertRaises(Exception): | ||
test_gesture.get_gesture_id() | ||
|
||
def test_instance_id_sanity(self): | ||
''' Should not allow a blank or None instance ID to go unnoticed ''' | ||
test_gesture = Gesture(1, None) | ||
with self.assertRaises(Exception): | ||
test_gesture.get_instance_id() | ||
|
||
test_gesture = Gesture(1, '') | ||
with self.assertRaises(Exception): | ||
test_gesture.get_instance_id() | ||
|
||
if __name__ == '__main__': | ||
unittest.main() |