[Libreoffice-commits] core.git: sw/qa

kadertarlan kadertarlan1 at gmail.com
Fri Jan 29 00:25:40 PST 2016


 sw/qa/python/check_indexed_property_values.py |   14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

New commits:
commit 679bcbe06dc063414151ce05d4bf3e3b44f2de8d
Author: kadertarlan <kadertarlan1 at gmail.com>
Date:   Thu Jan 28 20:51:10 2016 +0200

    tdf#97362: Fixed Python unit test (check_indexed_property_values.py)
    
    Change-Id: Ib8cfaccaaf5bf75169c96e46d95ff118cc850f79
    v2: Deleted whitespaces
    Reviewed-on: https://gerrit.libreoffice.org/21886
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: jan iversen <jani at documentfoundation.org>

diff --git a/sw/qa/python/check_indexed_property_values.py b/sw/qa/python/check_indexed_property_values.py
index 0e18b94..b146359 100644
--- a/sw/qa/python/check_indexed_property_values.py
+++ b/sw/qa/python/check_indexed_property_values.py
@@ -23,6 +23,8 @@ from org.libreoffice.unotest import UnoInProcess
 from com.sun.star.beans import PropertyValue
 from com.sun.star.container import XIndexContainer
 from org.libreoffice.unotest import OfficeConnection
+from com.sun.star.lang import IllegalArgumentException
+from com.sun.star.lang import IndexOutOfBoundsException
 
 class CheckIndexedPropertyValues(unittest.TestCase):
 
@@ -53,7 +55,7 @@ class CheckIndexedPropertyValues(unittest.TestCase):
         prop3 = uno.Any("[]com.sun.star.beans.PropertyValue", (p3,))
 
         t = xCont.getElementType()
-        self.assertEqual(0, xCont.getCount()) #Initial container is not empty
+        self.assertEqual(0, xCont.getCount(), "Initial container is not empty")
         uno.invoke(xCont, "insertByIndex", (0, prop1))
 
         ret = xCont.getByIndex(0)
@@ -66,10 +68,10 @@ class CheckIndexedPropertyValues(unittest.TestCase):
         self.assertEqual(p2.Value, ret[0].Value)
 
         xCont.removeByIndex(0)
-        self.assertTrue(not(xCont.hasElements()) and xCont.getCount()==0) #Could not remove PropertyValue
+        self.assertTrue(not(xCont.hasElements()) and xCont.getCount()==0, "Could not remove PropertyValue")
         uno.invoke(xCont, "insertByIndex", (0, prop1))
         uno.invoke(xCont, "insertByIndex", (1, prop2))
-        self.assertTrue(xCont.hasElements() and xCont.getCount()==2) #Did not insert PropertyValue
+        self.assertTrue(xCont.hasElements() and xCont.getCount()==2, "Did not insert PropertyValue")
 
         uno.invoke(xCont, "insertByIndex", (1, prop2))
         uno.invoke(xCont, "insertByIndex", (1, prop3))
@@ -77,11 +79,11 @@ class CheckIndexedPropertyValues(unittest.TestCase):
         self.assertEqual(p3.Name, ret[0].Name)
         self.assertEqual(p3.Value, ret[0].Value)
 
-        with self.assertRaises(Exception):
+        with self.assertRaises(IndexOutOfBoundsException):
             uno.invoke(xCont, "insertByIndex", (25, prop2))
 
-        with self.assertRaises(Exception):
+        with self.assertRaises(IndexOutOfBoundsException):
             xCont.removeByIndex(25)
 
-        with self.assertRaises(Exception):
+        with self.assertRaises(IllegalArgumentException):
             uno.invoke(xCont, "insertByIndex", (3, "Example String"))


More information about the Libreoffice-commits mailing list