MCPcopy Create free account
hub / github.com/EntilZha/PyFunctional / test_first

Method test_first

functional/test/test_functional.py:139–147  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

137 l.head()
138
139 def test_first(self):
140 l = self.seq([1, 2, 3]).map(lambda x: x)
141 self.assertEqual(l.first(), 1)
142 l = self.seq([[1, 2], 3, 4]).map(lambda x: x)
143 self.assertEqual(l.first(), [1, 2])
144 self.assert_type(l.first())
145 l = self.seq([])
146 with self.assertRaises(IndexError):
147 l.head()
148
149 def test_head_option(self):
150 l = self.seq([1, 2, 3]).map(lambda x: x)

Callers

nothing calls this directly

Calls 4

assert_typeMethod · 0.95
mapMethod · 0.80
firstMethod · 0.80
headMethod · 0.80

Tested by

no test coverage detected