Writing a unit-test case for code that depends on a sorteddict, I test the case of passing invalid index values to a method that depends on a keysvalue[index] and a valuesview[index].
To my surprise I found that passing j<0 did not raise an exception, provided abs(j)<=len(self.values_view), in fact it returns self.values_view[len(self.values_view)+j] and only raises IndexError when the index is outside this mirror-range.
Writing a unit-test case for code that depends on a sorteddict, I test the case of passing invalid index values to a method that depends on a keysvalue[index] and a valuesview[index].
To my surprise I found that passing j<0 did not raise an exception, provided abs(j)<=len(self.values_view), in fact it returns
self.values_view[len(self.values_view)+j]
and only raises IndexError when the index is outside this mirror-range.Is this expected behavior?