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

Method test_head

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

Source from the content-addressed store, hash-verified

127 self.assertEqual(l0 + l2, expect)
128
129 def test_head(self):
130 l = self.seq([1, 2, 3]).map(lambda x: x)
131 self.assertEqual(l.head(), 1)
132 l = self.seq([[1, 2], 3, 4])
133 self.assertEqual(l.head(), [1, 2])
134 self.assert_type(l.head())
135 l = self.seq([])
136 with self.assertRaises(IndexError):
137 l.head()
138
139 def test_first(self):
140 l = self.seq([1, 2, 3]).map(lambda x: x)

Callers

nothing calls this directly

Calls 3

assert_typeMethod · 0.95
mapMethod · 0.80
headMethod · 0.80

Tested by

no test coverage detected