Exemplo n.º 1
0
 def test_pretty_list_repr_str_list(self):
     lst = [ 'Apple', 'Banana', 'Tina\'s Pear', 'Red', 'Green', 'Blue']
     lst_repr = utils.pretty_list_repr(lst, max_line_len=30)
     self.assertEqual(lst_repr,
                      ('''[      'Apple',      'Banana',\n'''
                       ''' "Tina's Pear",         'Red',\n'''
                       '''       'Green',        'Blue']'''))
Exemplo n.º 2
0
 def test_pretty_list_format(self):
     lst = [123.92704029, 1.98628919, 20.99657472, 6.69566871, 5.0193061]
     lst_repr = utils.pretty_list_repr(lst,
                                       max_line_len=20,
                                       value_format='{0:.3f}')
     self.assertEqual(lst_repr,
                      '[123.927,   1.986,\n  20.997,   6.696,\n   5.019]')
Exemplo n.º 3
0
def test_pretty_list_format():
    lst = [123.92704029, 1.98628919, 20.99657472, 6.69566871, 5.0193061]
    lst_repr = utils.pretty_list_repr(lst,
                                      max_line_len=20,
                                      value_format="{0:.3f}")
    expected_repr = "[123.927,   1.986,\n  20.997,   6.696,\n   5.019]"
    assert lst_repr == expected_repr
Exemplo n.º 4
0
def test_pretty_list_repr_str_list():
    lst = ["Apple", "Banana", "Tina's Pear", "Red", "Green", "Blue"]
    lst_repr = utils.pretty_list_repr(lst, max_line_len=30)
    assert lst_repr == (
        """[      'Apple',      'Banana',\n"""
        """ "Tina's Pear",         'Red',\n"""
        """       'Green',        'Blue']"""
    )
Exemplo n.º 5
0
def test_pretty_list_repr_no_wrap():
    lst = [8,  3,  3, 14,  4,  4,  6,  5, 14, 9, 13,  2, 18, 10,  4, 15, 12]
    assert utils.pretty_list_repr(lst, max_line_len=80) == (
        '[ 8,  3,  3, 14,  4,  4,  6,  5, 14,  9,'
        ' 13,  2, 18, 10,  4, 15, 12]'
    )
Exemplo n.º 6
0
 def test_pretty_waveform_repr_empty_list(self):
     lst = []
     lst_repr = utils.pretty_list_repr(lst)
     self.assertEqual(lst_repr, '[]')
Exemplo n.º 7
0
 def test_pretty_list_repr_str_list(self):
     lst = ['Apple', 'Banana', 'Tina\'s Pear', 'Red', 'Green', 'Blue']
     lst_repr = utils.pretty_list_repr(lst, max_line_len=30)
     self.assertEqual(lst_repr, ('''[      'Apple',      'Banana',\n'''
                                 ''' "Tina's Pear",         'Red',\n'''
                                 '''       'Green',        'Blue']'''))
Exemplo n.º 8
0
 def test_pretty_list_repr_no_wrap(self):
     lst = [8, 3, 3, 14, 4, 4, 6, 5, 14, 9, 13, 2, 18, 10, 4, 15, 12]
     self.assertEqual(utils.pretty_list_repr(lst, max_line_len=80),
                      ('[ 8,  3,  3, 14,  4,  4,  6,  5, 14,  9,'
                       ' 13,  2, 18, 10,  4, 15, 12]'))
Exemplo n.º 9
0
def test_pretty_waveform_repr_empty_list():
    lst = []
    lst_repr = utils.pretty_list_repr(lst)
    assert lst_repr == "[]"
Exemplo n.º 10
0
def test_pretty_list_repr_no_wrap():
    lst = [8, 3, 3, 14, 4, 4, 6, 5, 14, 9, 13, 2, 18, 10, 4, 15, 12]
    assert utils.pretty_list_repr(
        lst, max_line_len=80) == ("[ 8,  3,  3, 14,  4,  4,  6,  5, 14,  9,"
                                  " 13,  2, 18, 10,  4, 15, 12]")
Exemplo n.º 11
0
 def test_pretty_waveform_repr_empty_list(self):
     lst = []
     lst_repr = utils.pretty_list_repr(lst)
     self.assertEqual(lst_repr, '[]')
Exemplo n.º 12
0
 def test_pretty_list_format(self):
     lst = [ 123.92704029,  1.98628919,  20.99657472,
             6.69566871,  5.0193061 ]
     lst_repr = utils.pretty_list_repr(lst, max_line_len=20, value_format='{0:.3f}')
     self.assertEqual(lst_repr,
         '[123.927,   1.986,\n  20.997,   6.696,\n   5.019]')
Exemplo n.º 13
0
 def test_pretty_list_repr_no_wrap(self):
     lst = [ 8,  3,  3, 14,  4,  4,  6,  5, 14,
             9, 13,  2, 18, 10,  4, 15, 12]
     self.assertEqual(utils.pretty_list_repr(lst, max_line_len=80),
                      ('[ 8,  3,  3, 14,  4,  4,  6,  5, 14,  9,'
                       ' 13,  2, 18, 10,  4, 15, 12]'))
Exemplo n.º 14
0
def test_pretty_list_repr_empty_list():
    lst = []
    lst_repr = utils.pretty_list_repr(lst)
    assert lst_repr == "[]"
Exemplo n.º 15
0
def test_pretty_list_format():
    lst = [123.92704029,  1.98628919,  20.99657472, 6.69566871,  5.0193061]
    lst_repr = utils.pretty_list_repr(lst, max_line_len=20, value_format='{0:.3f}')
    expected_repr = '[123.927,   1.986,\n  20.997,   6.696,\n   5.019]'
    assert lst_repr == expected_repr
Exemplo n.º 16
0
def test_pretty_list_repr_str_list():
    lst = ["Apple", "Banana", "Tina's Pear", "Red", "Green", "Blue"]
    lst_repr = utils.pretty_list_repr(lst, max_line_len=30)
    assert lst_repr == ("""[      'Apple',      'Banana',\n"""
                        """ "Tina's Pear",         'Red',\n"""
                        """       'Green',        'Blue']""")
Exemplo n.º 17
0
def test_pretty_waveform_repr_empty_list():
    lst = []
    lst_repr = utils.pretty_list_repr(lst)
    assert lst_repr == '[]'
Exemplo n.º 18
0
def test_pretty_list_repr():
    lst = [8, 3, 3, 14, 4, 4, 6, 5, 14, 9, 13, 2, 18, 10, 4, 15, 12]
    assert utils.pretty_list_repr(lst, max_line_len=40) == (
        "[ 8,  3,  3, 14,  4,  4,  6,  5, 14,  9,\n" " 13,  2, 18, 10,  4, 15, 12]"
    )