summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaulo Alcantara <paulo.alcantara@openbossa.org>2011-04-25 15:52:04 -0300
committerHugo Parente Lima <hugo.pl@gmail.com>2012-03-08 16:54:16 -0300
commitcecd566782a01e41464ac2f6273f63fd78b57b8b (patch)
treed189366aee935c39be87d812fa88b7a71d91423e
parent5a80d6418bf2cbe5bb14819db5d022d52bec0d75 (diff)
Create unit test for QIPv6Address
Signed-off-by: Paulo Alcantara <paulo.alcantara@openbossa.org> Reviewer: Renato Araujo <renato.araujo@openbossa.org> Marcelo Lira <marcelo.lira@openbossa.org>
-rw-r--r--tests/QtNetwork/CMakeLists.txt1
-rw-r--r--tests/QtNetwork/qipv6address_test.py22
2 files changed, 23 insertions, 0 deletions
diff --git a/tests/QtNetwork/CMakeLists.txt b/tests/QtNetwork/CMakeLists.txt
index 9b0be3ab..30771554 100644
--- a/tests/QtNetwork/CMakeLists.txt
+++ b/tests/QtNetwork/CMakeLists.txt
@@ -4,3 +4,4 @@ PYSIDE_TEST(accessManager_test.py)
PYSIDE_TEST(http_test.py)
PYSIDE_TEST(tcpserver_test.py)
PYSIDE_TEST(udpsocket_test.py)
+PYSIDE_TEST(qipv6address_test.py)
diff --git a/tests/QtNetwork/qipv6address_test.py b/tests/QtNetwork/qipv6address_test.py
new file mode 100644
index 00000000..eeb4c61c
--- /dev/null
+++ b/tests/QtNetwork/qipv6address_test.py
@@ -0,0 +1,22 @@
+'''Test cases for QIPv6Address'''
+
+import unittest
+
+from PySide.QtNetwork import *
+
+class QIPv6AddressGetItemTest(unittest.TestCase):
+ def testLength(self):
+ ip = QIPv6Address()
+ self.assertEqual(len(ip), 16)
+
+ def testSetItemNegativeIndex(self):
+ ip = QIPv6Address()
+ ip[-1] = 8
+ self.assertEqual(ip[-1], 8)
+
+ def testSetItemLargeIndex(self):
+ ip = QIPv6Address()
+ self.assertRaises(IndexError, ip.__setitem__, 32, 16)
+
+if __name__ == '__main__':
+ unittest.main()