コード例 #1
0
ファイル: test_dictarray.py プロジェクト: jbw900/cogent3
 def test_get_repr_html(self):
     """exercising method used by parent classes for nice Jupyter display"""
     data = [[3, 7], [2, 8], [5, 5]]
     darr = DictArrayTemplate(list("ABC"), list("ab")).wrap(data)
     got = darr._repr_html_()
     self.assertIsInstance(got, str)
     self.assertTrue(len(got), 100)
コード例 #2
0
    def test_get_repr_html(self):
        """exercising method used by parent classes for nice Jupyter display"""
        data = [[3, 7], [2, 8], [5, 5]]
        darr = DictArrayTemplate(list("ABC"), list("ab")).wrap(data)
        got = darr._repr_html_()
        self.assertIsInstance(got, str)
        self.assertTrue(len(got), 100)

        # case where 1D array
        a = [4, 6, 4, 2]
        darr = DictArrayTemplate(["A", "C", "G", "T"]).wrap(a)
        got = darr._repr_html_()
        self.assertTrue('class="index"' not in got)

        # case of 3D array
        d3 = numpy.arange(8).reshape((2, 2, 2))
        darr = DictArrayTemplate(2, 2, 2).wrap(d3)
        got = darr._repr_html_()
        self.assertIn("3 dimensional", got)