예제 #1
0
    def test_raise_on_negative_width_of_account_number(self):

        i = -1
        handler = AccViewerHandler()
        with self.assertRaises(ValueError, msg=i):
            handler.start('h', 3, i, 'm')
            handler.end()
예제 #2
0
 def check(lst):
     handler = AccViewerHandler()
     handler.start('h', 3, 4, 'm')
     handler.print_pages(lst)
     handler.end()
     output = self.read_output()
     return output
예제 #3
0
    def test_raise_on_zero_page_size(self):

        i = 0
        handler = AccViewerHandler()
        with self.assertRaises(ValueError, msg=i):
            handler.start('h', i, 4, 'm')
            handler.end()
예제 #4
0
    def test_will_replace_to_none_empty_user_name(self):

        i = [('a', 'b', None)]
        handler = AccViewerHandler()
        handler.start('h', 3, 4, 'm')
        handler.print_pages(i)
        handler.end()
        o = self.read_output()

        def match(s):
            res = ('1 a\n         None at "b"' in s, )
            return all(res)

        self.assertTrue(match(o), msg=(i, o))
예제 #5
0
    def test_will_replace_to_unknown_empty_account_name(self):

        i = [(None, 'b', 'c')]
        handler = AccViewerHandler()
        handler.start('h', 3, 4, 'm')
        handler.print_pages(i)
        handler.end()
        o = self.read_output()

        def match(s):
            res = ('1 Unknown\n         "c" at "b"' in s, )
            return all(res)

        self.assertTrue(match(o), msg=(i, o))
예제 #6
0
    def test_can_have_unicode_chars_in_message(self):

        i = 'm深'
        handler = AccViewerHandler()
        handler.start('h', 3, 4, i)
        handler.print_pages([('a', 'b', 'c')])
        handler.end()
        o = self.read_output()

        def match(s):
            res = ('1 a\n         "c" at "b"' in s, s.endswith(i + '\n'))
            return all(res)

        self.assertTrue(match(o), msg=(i, o))
예제 #7
0
    def test_can_have_unicode_chars_in_header(self):

        i = 'h深'
        handler = AccViewerHandler()
        handler.start(i, 3, 4, 'm')
        handler.print_pages([('a', 'b', 'c')])
        handler.end()
        o = self.read_output()

        def match(s):
            res = (s.startswith(i), '1 a\n         "c" at "b"' in s)
            return all(res)

        self.assertTrue(match(o), msg=(i, o))