예제 #1
0
def test_standard():

    l1 = gj2ascii.array2ascii([['*', '*', '*', '*', '*'],
                               [' ', ' ', '*', ' ', ' '],
                               ['*', '*', ' ', ' ', ' ']])

    l2 = gj2ascii.array2ascii([[' ', ' ', ' ', '+', '+'],
                               [' ', '+', ' ', ' ', ' '],
                               [' ', ' ', '+', '+', '+']])

    eo = gj2ascii.array2ascii([['*', '*', '*', '+', '+'],
                               ['.', '+', '*', '.', '.'],
                               ['*', '*', '+', '+', '+']])

    assert gj2ascii.stack([l1, l2],
                          fill='.').strip(os.linesep), eo.strip(os.linesep)
예제 #2
0
파일: test_core.py 프로젝트: nerik/gj2ascii
    def test_standard(self):

        l1 = gj2ascii.array2ascii([['*', '*', '*', '*', '*'],
                                   [' ', ' ', '*', ' ', ' '],
                                   ['*', '*', ' ', ' ', ' ']])

        l2 = gj2ascii.array2ascii([[' ', ' ', ' ', '+', '+'],
                                   [' ', '+', ' ', ' ', ' '],
                                   [' ', ' ', '+', '+', '+']])

        eo = gj2ascii.array2ascii([['*', '*', '*', '+', '+'],
                                   ['.', '+', '*', '.', '.'],
                                   ['*', '*', '+', '+', '+']])

        self.assertEqual(gj2ascii.stack(
            [l1, l2], fill='.').strip(os.linesep), eo.strip(os.linesep))
예제 #3
0
def test_style():

    array = [['0', '0', '0', '1', '0'], [' ', ' ', '2', '0', '1'],
             ['1', '1', '2', '1', '3']]
    colormap = {
        ' ': 'black',
        '0': 'blue',
        '1': 'yellow',
        '2': 'white',
        '3': 'red'
    }
    expected = []
    for row in array:
        o_row = []
        for char in row:
            color = gj2ascii.ANSI_COLORMAP[colormap[char]]
            o_row.append(color + char + ' ' + gj2ascii.core._ANSI_RESET)
        expected.append(''.join(o_row))
    expected = os.linesep.join(expected)
    assert expected == gj2ascii.style(gj2ascii.array2ascii(array),
                                      stylemap=colormap)
예제 #4
0
파일: test_core.py 프로젝트: nerik/gj2ascii
    def test_style(self):

        array = [['0', '0', '0', '1', '0'],
                 [' ', ' ', '2', '0', '1'],
                 ['1', '1', '2', '1', '3']]
        colormap = {
            ' ': 'black',
            '0': 'blue',
            '1': 'yellow',
            '2': 'white',
            '3': 'red'
        }
        expected = []
        for row in array:
            o_row = []
            for char in row:
                color = gj2ascii.ANSI_COLORMAP[colormap[char]]
                o_row.append(color + char + ' ' + gj2ascii.core._ANSI_RESET)
            expected.append(''.join(o_row))
        expected = os.linesep.join(expected)
        self.assertEqual(
            expected, gj2ascii.style(gj2ascii.array2ascii(array), stylemap=colormap))
예제 #5
0
def test_roundhouse(ascii, array):
    assert ascii == gj2ascii.array2ascii(gj2ascii.ascii2array(ascii))
    assert array == gj2ascii.ascii2array(gj2ascii.array2ascii(array))
예제 #6
0
def test_array2ascii(ascii, array):
    assert ascii == gj2ascii.array2ascii(array)
    assert ascii == gj2ascii.array2ascii(array)
예제 #7
0
def test_single_layer(compare_ascii):
    l1 = gj2ascii.array2ascii([['*', '*', '*', '*', '*'],
                               [' ', ' ', '*', ' ', ' '],
                               ['*', '*', ' ', ' ', ' ']])

    assert compare_ascii(l1, gj2ascii.stack([l1]))
예제 #8
0
 def test_roundhouse(self):
     self.assertEqual(self.ascii, gj2ascii.array2ascii(gj2ascii.ascii2array(self.ascii)))
     self.assertEqual(self.array, gj2ascii.ascii2array(gj2ascii.array2ascii(self.array)))
예제 #9
0
 def test_array2ascii(self):
     self.assertEqual(self.ascii, gj2ascii.array2ascii(self.array))
     self.assertEqual(self.ascii, gj2ascii.array2ascii(self.np_array))
예제 #10
0
    def test_single_layer(self):
        l1 = gj2ascii.array2ascii([['*', '*', '*', '*', '*'],
                                   [' ', ' ', '*', ' ', ' '],
                                   ['*', '*', ' ', ' ', ' ']])

        self.assertTrue(compare_ascii(l1, gj2ascii.stack([l1])))