2 new revisions:
Revision: 3ca3fb854bd4
Branch: default
Author: Pekka Klärck
Date: Tue Aug 27 19:24:22 2013 UTC
Log: ItemList: better error type and message when trying to slice
http://code.google.com/p/robotframework/source/detail?r=3ca3fb854bd4
Revision: af7feeea1156
Branch: default
Author: Pekka Klärck
Date: Tue Aug 27 19:34:18 2013 UTC
Log: ItemList: additional utests
http://code.google.com/p/robotframework/source/detail?r=af7feeea1156
==============================================================================
Revision: 3ca3fb854bd4
Branch: default
Author: Pekka Klärck
Date: Tue Aug 27 19:24:22 2013 UTC
Log: ItemList: better error type and message when trying to slice
http://code.google.com/p/robotframework/source/detail?r=3ca3fb854bd4
Modified:
/src/robot/model/itemlist.py
/utest/model/test_itemlist.py
=======================================
--- /src/robot/model/itemlist.py Thu Jun 6 14:00:44 2013 UTC
+++ /src/robot/model/itemlist.py Tue Aug 27 19:24:22 2013 UTC
@@ -59,7 +59,8 @@
def __getitem__(self, index):
if isinstance(index, slice):
- raise ValueError("'%s' object does not support slicing" %
type(self).__name__)
+ raise TypeError("'%s' objects do not support slicing."
+ % type(self).__name__)
return self._items[index]
def __len__(self):
=======================================
--- /utest/model/test_itemlist.py Mon Mar 5 15:03:05 2012 UTC
+++ /utest/model/test_itemlist.py Tue Aug 27 19:24:22 2013 UTC
@@ -59,7 +59,7 @@
assert_true(items[-1] is item2)
def test_getitem_slice_is_not_supported(self):
- assert_raises(ValueError, ItemList(int).__getitem__, slice(0))
+ assert_raises(TypeError, ItemList(int).__getitem__, slice(0))
def test_len(self):
items = ItemList(object)
==============================================================================
Revision: af7feeea1156
Branch: default
Author: Pekka Klärck
Date: Tue Aug 27 19:34:18 2013 UTC
Log: ItemList: additional utests
http://code.google.com/p/robotframework/source/detail?r=af7feeea1156
Modified:
/utest/model/test_itemlist.py
=======================================
--- /utest/model/test_itemlist.py Tue Aug 27 19:24:22 2013 UTC
+++ /utest/model/test_itemlist.py Tue Aug 27 19:34:18 2013 UTC
@@ -61,12 +61,21 @@
def test_getitem_slice_is_not_supported(self):
assert_raises(TypeError, ItemList(int).__getitem__, slice(0))
+ def test_index(self):
+ items = ItemList(str, items=('first', 'second'))
+ assert_equal(items.index('first'), 0)
+ assert_equal(items.index('second'), 1)
+
def test_len(self):
items = ItemList(object)
assert_equal(len(items), 0)
items.create()
assert_equal(len(items), 1)
+ def test_truth(self):
+ assert_true(not ItemList(int))
+ assert_true(ItemList(int, items=[1]))
+
def test_clear(self):
items = ItemList(int, range(10))
items.clear()
--
---
You received this message because you are subscribed to the Google Groups "robotframework-commit" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.