@@ -0,0 +1,2452 @@
+# -*- coding: utf-8 -*-%0A%0A# Copyright (c) 2020 shmilee%0A%0A'''%0ARun me in different terminals.%0A'''%0A%0Aimport sys%0Aimport unittest%0A%0Afrom ..imgcat import Display%0A%0A%0Aclass TestDisplay(unittest.TestCase):%0A    '''%0A    Test class :py:class:%60imgcat.Display%60%0A    '''%0A%0A    def setUp(self):%0A        self.imcat = Display(max_width=800)%0A%0A    def test_imcat_init(self):%0A        self.assertTrue(isinstance(self.imcat.cmd, (str, type(None))))%0A        self.assertTrue(isinstance(self.imcat.mod, (type(sys), type(None))))%0A        #self.assertTrue(self.imcat.output == sys.stdout)%0A        self.assertEqual(self.imcat.max_width, 800)%0A%0A%0Adef test_dispaly_mplfig(imcat=None):%0A    from ..mplvisplter import MatplotlibVisplter%0A    from .test_mplvisplter import temp_lineresults%0A%0A    visplter = MatplotlibVisplter('mpl::test')%0A    visplter.style = %5B'gdpy3-notebook', %7B'figure.figsize': (15.0, 12.0)%7D%5D%0A    axstruct, sty = visplter.tmpl_line(temp_lineresults)%0A    fig = visplter.create_figure('test-line', *axstruct, add_style=sty)%0A    imcat = imcat if isinstance(imcat, Display) else Display(max_width=1000)%0A    imcat.show_attr_info()%0A    input('%5BI%5Dnterrupt, to see imcat info')%0A%0A    imcat.display(fig)%0A    input('%5BI%5Dnterrupt, to see figure size 1000x800')%0A    imcat.display(fig, width=500)%0A    input('%5BI%5Dnterrupt, to see figure size 500x400')%0A    imcat.display(fig, height=500)%0A    input('%5BI%5Dnterrupt, to see figure size 625x500')%0A    imcat.display(fig, width=50)%0A    input('%5BI%5Dnterrupt, to see figure size 50x40, for cell count only!')%0A    imcat.display(fig, width=500, usemod=True)%0A    input('%5BI%5Dnterrupt, to see figure size 500x400, usemod=True')%0A%0A%0Adef test_dispaly_file(path, imcat=None):%0A    imcat = imcat if isinstance(imcat, Display) else Display(max_width=1366)%0A    imcat.show_attr_info()%0A    input('%5BI%5Dnterrupt, to see imcat info')%0A    with open(path, 'rb') as f:%0A        data = f.read()%0A    for put in (path, data):%0A        input('%5BI%5Dnterrupt, the input image is %25s' %25 type(put))%0A        imcat.display(put)%0A        input('%5BI%5Dnterrupt, to see image original size')%0A        imcat.display(put, width=500)%0A        input('%5BI%5Dnterrupt, to see image width 500')%0A        imcat.display(put, height=500)%0A        input('%5BI%5Dnterrupt, to see image height 500')%0A        imcat.display(put, width=50)%0A        input('%5BI%5Dnterrupt, to see image width 50, for cell count only!')%0A        imcat.display(put, width=500, usemod=True)%0A        input('%5BI%5Dnterrupt, to see image width 500, usemod=True')%0A

add test for imgcat, part unittest