Beispiel #1
0
 def test_should_support_indexing(self):
     self.assertEqual(0, Selector(self.iterable)[0])
     self.assertEqual(1, Selector(self.iterable)[1])
     self.assertEqual(2, Selector(self.iterable)[2])
     self.assertEqual(2, Selector(self.iterable)[-1])
Beispiel #2
0
 def test_should_support_iteration(self):
     self.assertSequenceEqual(self.iterable, list(Selector(self.iterable)))
     self.assertSequenceEqual(self.iterable, Selector(self.iterable).all())
Beispiel #3
0
 def test_should_return_default_when_index_lower(self):
     self.assertEqual(Default(5), Selector(self.iterable, 5).item(-5))
Beispiel #4
0
 def test_should_support_index_below_zero(self):
     self.assertEqual(0, Selector(self.iterable).item(-3))
Beispiel #5
0
 def test_should_return_by_index(self):
     self.assertEqual(1, Selector(self.iterable).item(1))
Beispiel #6
0
 def test_should_return_last_element(self):
     self.assertEqual(2, Selector(self.iterable).last())
Beispiel #7
0
 def test_should_return_first_element(self):
     self.assertEqual(0, Selector(self.iterable).first())