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

Method test_tabulate

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

Source from the content-addressed store, hash-verified

901 self.assertEqual(repr(result._lineage), "Lineage: sequence")
902
903 def test_tabulate(self):
904 sequence = seq([[1, 2, 3], [4, 5, 6]])
905 self.assertEqual(sequence.show(), None)
906 self.assertNotEqual(sequence._repr_html_(), None)
907 result = sequence.tabulate()
908 self.assertEqual(result, "- - -\n1 2 3\n4 5 6\n- - -")
909
910 sequence = seq(1, 2, 3)
911 self.assertEqual(sequence.tabulate(), None)
912
913 class NotTabulatable(object):
914 pass
915
916 sequence = seq(NotTabulatable(), NotTabulatable(), NotTabulatable())
917 self.assertEqual(sequence.tabulate(), None)
918
919 long_data = seq([(i, i + 1) for i in range(30)])
920 self.assertTrue("Showing 10 of 30 rows" in long_data.tabulate(n=10))
921 self.assertTrue("Showing 10 of 30 rows" in long_data._repr_html_())
922 self.assertTrue(
923 "Showing 10 of 30 rows" not in long_data.tabulate(n=10, tablefmt="plain")
924 )
925
926 def test_tabulate_namedtuple(self):
927 sequence_tabulated = seq([Data(1, 2), Data(6, 7)]).tabulate()

Callers

nothing calls this directly

Calls 4

NotTabulatableClass · 0.85
showMethod · 0.80
_repr_html_Method · 0.80
tabulateMethod · 0.80

Tested by

no test coverage detected