summaryrefslogtreecommitdiff
path: root/pyuno
diff options
context:
space:
mode:
authorMayank Suman <mayanksuman@live.com>2019-10-03 16:28:07 +0530
committerXisco Faulí <xiscofauli@libreoffice.org>2019-12-05 16:51:36 +0100
commit574cfcacc5489f8995d697126dd463e3df25a4d6 (patch)
tree8ddaf947b2625d0f40fec24576f1ce29ad98cca4 /pyuno
parentd5acf921efbd3170e487d4656e38c23c3f835094 (diff)
tdf#97361: Removed getByTindex in Pyuno pytests
Change-Id: Idf2e8567a154b25b1625b9cd1651bd77cc684859 Reviewed-on: https://gerrit.libreoffice.org/80116 Tested-by: Jenkins Reviewed-by: Xisco Faulí <xiscofauli@libreoffice.org>
Diffstat (limited to 'pyuno')
-rw-r--r--pyuno/demo/swriter.py2
-rw-r--r--pyuno/demo/swritercomp.py2
-rw-r--r--pyuno/qa/pytests/testcollections_XCellRange.py34
-rw-r--r--pyuno/qa/pytests/testcollections_XIndexAccess.py2
-rw-r--r--pyuno/qa/pytests/testcollections_XIndexContainer.py4
-rw-r--r--pyuno/qa/pytests/testcollections_XIndexReplace.py3
-rw-r--r--pyuno/qa/pytests/testcollections_XNameAccess.py4
-rw-r--r--pyuno/qa/pytests/testcollections_XNameContainer.py8
8 files changed, 30 insertions, 29 deletions
diff --git a/pyuno/demo/swriter.py b/pyuno/demo/swriter.py
index 4f3916136c30..90a53e826545 100644
--- a/pyuno/demo/swriter.py
+++ b/pyuno/demo/swriter.py
@@ -67,7 +67,7 @@ rows = table.Rows
table.setPropertyValue( "BackTransparent", False )
table.setPropertyValue( "BackColor", 13421823 )
-row = rows.getByIndex(0)
+row = rows[0]
row.setPropertyValue( "BackTransparent", False )
row.setPropertyValue( "BackColor", 6710932 )
diff --git a/pyuno/demo/swritercomp.py b/pyuno/demo/swritercomp.py
index 3bdd252e4e44..7c200cc7bea5 100644
--- a/pyuno/demo/swritercomp.py
+++ b/pyuno/demo/swritercomp.py
@@ -68,7 +68,7 @@ class SWriterComp(XMain,unohelper.Base):
table.setPropertyValue( "BackTransparent", uno.Bool(0) )
table.setPropertyValue( "BackColor", 13421823 )
- row = rows.getByIndex(0)
+ row = rows[0]
row.setPropertyValue( "BackTransparent", uno.Bool(0) )
row.setPropertyValue( "BackColor", 6710932 )
diff --git a/pyuno/qa/pytests/testcollections_XCellRange.py b/pyuno/qa/pytests/testcollections_XCellRange.py
index 2e0ef8a7d3d7..3f610ca3485c 100644
--- a/pyuno/qa/pytests/testcollections_XCellRange.py
+++ b/pyuno/qa/pytests/testcollections_XCellRange.py
@@ -33,7 +33,7 @@ class TestXCellRange(CollectionsTestBase):
def test_XCellRange_Spreadsheet_Cell_00(self):
# Given
spr = self.createBlankSpreadsheet()
- sht = spr.Sheets.getByIndex(0)
+ sht = spr.Sheets[0]
# When
cell = sht[0, 0]
@@ -57,7 +57,7 @@ class TestXCellRange(CollectionsTestBase):
text_table.initialize(10, 10)
cursor = doc.Text.createTextCursor()
doc.Text.insertTextContent(cursor, text_table, False)
- tbl = doc.TextTables.getByIndex(0)
+ tbl = doc.TextTables[0]
# When
cell = tbl[0, 0]
@@ -75,7 +75,7 @@ class TestXCellRange(CollectionsTestBase):
def test_XCellRange_Spreadsheet_Cell_37(self):
# Given
spr = self.createBlankSpreadsheet()
- sht = spr.Sheets.getByIndex(0)
+ sht = spr.Sheets[0]
# When
rng = sht[3, 7]
@@ -99,7 +99,7 @@ class TestXCellRange(CollectionsTestBase):
text_table.initialize(10, 10)
cursor = doc.Text.createTextCursor()
doc.Text.insertTextContent(cursor, text_table, False)
- tbl = doc.TextTables.getByIndex(0)
+ tbl = doc.TextTables[0]
# When
cell = tbl[3, 7]
@@ -116,7 +116,7 @@ class TestXCellRange(CollectionsTestBase):
def test_XCellRange_Spreadsheet_Range_Index_Slice(self):
# Given
spr = self.createBlankSpreadsheet()
- sht = spr.Sheets.getByIndex(0)
+ sht = spr.Sheets[0]
# When
rng = sht[0, 1:3]
@@ -141,7 +141,7 @@ class TestXCellRange(CollectionsTestBase):
text_table.initialize(10, 10)
cursor = doc.Text.createTextCursor()
doc.Text.insertTextContent(cursor, text_table, False)
- tbl = doc.TextTables.getByIndex(0)
+ tbl = doc.TextTables[0]
doc.lockControllers()
tbl.DataArray = tuple(tuple(str(100 + y) for y in range(10*x, 10*x + 10)) for x in range(10))
doc.unlockControllers()
@@ -161,7 +161,7 @@ class TestXCellRange(CollectionsTestBase):
def test_XCellRange_Spreadsheet_Range_Slice_Index(self):
# Given
spr = self.createBlankSpreadsheet()
- sht = spr.Sheets.getByIndex(0)
+ sht = spr.Sheets[0]
# When
rng = sht[1:3, 0]
@@ -186,7 +186,7 @@ class TestXCellRange(CollectionsTestBase):
text_table.initialize(10, 10)
cursor = doc.Text.createTextCursor()
doc.Text.insertTextContent(cursor, text_table, False)
- tbl = doc.TextTables.getByIndex(0)
+ tbl = doc.TextTables[0]
doc.lockControllers()
tbl.DataArray = tuple(tuple(str(100 + y) for y in range(10*x, 10*x + 10)) for x in range(10))
doc.unlockControllers()
@@ -206,7 +206,7 @@ class TestXCellRange(CollectionsTestBase):
def test_XCellRange_Spreadsheet_Range_Slices(self):
# Given
spr = self.createBlankSpreadsheet()
- sht = spr.Sheets.getByIndex(0)
+ sht = spr.Sheets[0]
# When
rng = sht[1:3, 3:5]
@@ -228,7 +228,7 @@ class TestXCellRange(CollectionsTestBase):
def test_XCellRange_Spreadsheet_Range_Slices_Invalid(self):
# Given
spr = self.createBlankSpreadsheet()
- sht = spr.Sheets.getByIndex(0)
+ sht = spr.Sheets[0]
# When / Then
with self.assertRaises(KeyError):
@@ -249,7 +249,7 @@ class TestXCellRange(CollectionsTestBase):
text_table.initialize(10, 10)
cursor = doc.Text.createTextCursor()
doc.Text.insertTextContent(cursor, text_table, False)
- tbl = doc.TextTables.getByIndex(0)
+ tbl = doc.TextTables[0]
doc.lockControllers()
tbl.DataArray = tuple(tuple(str(100 + y) for y in range(10*x, 10*x + 10)) for x in range(10))
doc.unlockControllers()
@@ -269,7 +269,7 @@ class TestXCellRange(CollectionsTestBase):
def test_XCellRange_Spreadsheet_Range_Descriptor(self):
# Given
spr = self.createBlankSpreadsheet()
- sht = spr.Sheets.getByIndex(0)
+ sht = spr.Sheets[0]
# When
rng = sht['A3:B4']
@@ -294,7 +294,7 @@ class TestXCellRange(CollectionsTestBase):
text_table.initialize(10, 10)
cursor = doc.Text.createTextCursor()
doc.Text.insertTextContent(cursor, text_table, False)
- tbl = doc.TextTables.getByIndex(0)
+ tbl = doc.TextTables[0]
doc.lockControllers()
tbl.DataArray = tuple(tuple(str(100 + y) for y in range(10*x, 10*x + 10)) for x in range(10))
doc.unlockControllers()
@@ -314,7 +314,7 @@ class TestXCellRange(CollectionsTestBase):
def test_XCellRange_Spreadsheet_Range_Name(self):
# Given
spr = self.createBlankSpreadsheet()
- sht = spr.Sheets.getByIndex(0)
+ sht = spr.Sheets[0]
expr = '$' + sht.Name + '.$C2:F10'
addr = CellAddress(Sheet=0, Row=1, Column=2)
sht.NamedRanges.addNewByName('foo', expr, addr, 0)
@@ -338,7 +338,7 @@ class TestXCellRange(CollectionsTestBase):
def test_XCellRange_Spreadsheet_Range_RowIndex(self):
# Given
spr = self.createBlankSpreadsheet()
- sht = spr.Sheets.getByIndex(0)
+ sht = spr.Sheets[0]
# When
rng = sht[0]
@@ -359,7 +359,7 @@ class TestXCellRange(CollectionsTestBase):
def test_XCellRange_Spreadsheet_Range_RowIndex_FullSlice(self):
# Given
spr = self.createBlankSpreadsheet()
- sht = spr.Sheets.getByIndex(0)
+ sht = spr.Sheets[0]
# When
rng = sht[0, :]
@@ -380,7 +380,7 @@ class TestXCellRange(CollectionsTestBase):
def test_XCellRange_Spreadsheet_Range_FullSlice_ColumnIndex(self):
# Given
spr = self.createBlankSpreadsheet()
- sht = spr.Sheets.getByIndex(0)
+ sht = spr.Sheets[0]
# When
rng = sht[:, 0]
diff --git a/pyuno/qa/pytests/testcollections_XIndexAccess.py b/pyuno/qa/pytests/testcollections_XIndexAccess.py
index 7228ed87336b..e3eeb45cec96 100644
--- a/pyuno/qa/pytests/testcollections_XIndexAccess.py
+++ b/pyuno/qa/pytests/testcollections_XIndexAccess.py
@@ -173,7 +173,7 @@ class TestXIndexAccess(CollectionsTestBase):
footnote = getFootnoteInstance(doc)
footnote.setLabel('foo')
doc.Text.insertTextContent(cursor, footnote, 0)
- footnote = doc.Footnotes.getByIndex(0)
+ footnote = doc.Footnotes[0]
# When
present = footnote in doc.Footnotes
diff --git a/pyuno/qa/pytests/testcollections_XIndexContainer.py b/pyuno/qa/pytests/testcollections_XIndexContainer.py
index 73be6b57c25d..1df5f07740cb 100644
--- a/pyuno/qa/pytests/testcollections_XIndexContainer.py
+++ b/pyuno/qa/pytests/testcollections_XIndexContainer.py
@@ -66,7 +66,7 @@ class TestXIndexContainer(CollectionsTestBase):
self.assertEqual(None, captured)
self.assertEqual(len(expected), property_values.getCount())
for i in range(property_values.getCount()):
- self.assertEqual(to_compare[i][0].Name, property_values.getByIndex(i)[0].Name)
+ self.assertEqual(to_compare[i][0].Name, property_values[i][0].Name)
def deleteValuesTestFixture(self, count, key, expected):
# Given
@@ -91,7 +91,7 @@ class TestXIndexContainer(CollectionsTestBase):
self.assertEqual(None, captured)
self.assertEqual(len(expected), property_values.getCount())
for i in range(property_values.getCount()):
- self.assertEqual(to_compare[i][0].Name, property_values.getByIndex(i)[0].Name)
+ self.assertEqual(to_compare[i][0].Name, property_values[i][0].Name)
# Tests syntax:
# obj[2:4] = val1,val2 # Replace by slice
diff --git a/pyuno/qa/pytests/testcollections_XIndexReplace.py b/pyuno/qa/pytests/testcollections_XIndexReplace.py
index bbf424f0bdfb..78361cbcaaee 100644
--- a/pyuno/qa/pytests/testcollections_XIndexReplace.py
+++ b/pyuno/qa/pytests/testcollections_XIndexReplace.py
@@ -61,7 +61,8 @@ class TestXIndexReplace(CollectionsTestBase):
# expected is list
self.assertEqual(None, captured)
for i in range(10):
- self.assertEqual(toCompare[i][0], index.LevelParagraphStyles.getByIndex(i)[0])
+ self.assertEqual(toCompare[i][0],
+ index.LevelParagraphStyles[i][0])
# Tests syntax:
# obj[0] = val # Replace by index
diff --git a/pyuno/qa/pytests/testcollections_XNameAccess.py b/pyuno/qa/pytests/testcollections_XNameAccess.py
index 7f987a370077..498e17e28065 100644
--- a/pyuno/qa/pytests/testcollections_XNameAccess.py
+++ b/pyuno/qa/pytests/testcollections_XNameAccess.py
@@ -44,7 +44,7 @@ class TestXNameAccess(CollectionsTestBase):
def test_XNameAccess_ReadKey(self):
# Given
drw = self.createBlankDrawing()
- drw.DrawPages.getByIndex(0).Name = 'foo'
+ drw.DrawPages[0].Name = 'foo'
# When
link = drw.Links['foo']
@@ -145,7 +145,7 @@ class TestXNameAccess(CollectionsTestBase):
def test_XNameAccess_In(self):
# Given
drw = self.createBlankDrawing()
- drw.DrawPages.getByIndex(0).Name = 'foo'
+ drw.DrawPages[0].Name = 'foo'
# When
present = 'foo' in drw.Links
diff --git a/pyuno/qa/pytests/testcollections_XNameContainer.py b/pyuno/qa/pytests/testcollections_XNameContainer.py
index 5c8b676c0f6e..c544ca9dd181 100644
--- a/pyuno/qa/pytests/testcollections_XNameContainer.py
+++ b/pyuno/qa/pytests/testcollections_XNameContainer.py
@@ -33,7 +33,7 @@ class TestXNameContainer(CollectionsTestBase):
# Given
spr = self.createBlankSpreadsheet()
ranges = getSheetCellRangesInstance(spr)
- new_range = spr.Sheets.getByIndex(0).getCellRangeByPosition(1, 2, 1, 2)
+ new_range = spr.Sheets[0].getCellRangeByPosition(1, 2, 1, 2)
# When
ranges['foo'] = new_range
@@ -51,7 +51,7 @@ class TestXNameContainer(CollectionsTestBase):
# Given
spr = self.createBlankSpreadsheet()
ranges = getSheetCellRangesInstance(spr)
- new_range = spr.Sheets.getByIndex(0).getCellRangeByPosition(1, 2, 1, 2)
+ new_range = spr.Sheets[0].getCellRangeByPosition(1, 2, 1, 2)
# When / Then
with self.assertRaises(TypeError):
@@ -65,8 +65,8 @@ class TestXNameContainer(CollectionsTestBase):
# Given
spr = self.createBlankSpreadsheet()
ranges = getSheetCellRangesInstance(spr)
- new_range1 = spr.Sheets.getByIndex(0).getCellRangeByPosition(1, 2, 1, 2)
- new_range2 = spr.Sheets.getByIndex(0).getCellRangeByPosition(6, 6, 6, 6)
+ new_range1 = spr.Sheets[0].getCellRangeByPosition(1, 2, 1, 2)
+ new_range2 = spr.Sheets[0].getCellRangeByPosition(6, 6, 6, 6)
# When
ranges['foo'] = new_range1