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

Method test_distinct

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

Source from the content-addressed store, hash-verified

413 self.assert_type(result)
414
415 def test_distinct(self):
416 l = [1, 3, 1, 2, 2, 3]
417 expect = [1, 3, 2]
418 s = self.seq(l)
419 result = s.distinct()
420 self.assertEqual(result.size(), len(expect))
421 for er in zip(expect, result):
422 self.assertEqual(
423 er[0], er[1], "Order was not preserved after running distinct!"
424 )
425 for e in result:
426 self.assertTrue(e in expect)
427 self.assert_type(result)
428
429 def test_distinct_by(self):
430 s = self.seq(Data(1, 2), Data(1, 3), Data(2, 0), Data(3, -1), Data(1, 5))

Callers

nothing calls this directly

Calls 3

assert_typeMethod · 0.95
distinctMethod · 0.80
sizeMethod · 0.80

Tested by

no test coverage detected