Example #1
0
 def test_checker_helpers(self):
     compare(readability.main(msg_info='All'), [{
         'help': 'Projectors are notorious for not having good contrast.',
         'id': 'C3000',
         'msg': 'Projectors are notorious for not having good contrast.',
         'msg_name': 'text-readability',
         'page': ''
     }])
     compare(readability.main(msg_info=['C3000']), [{
         'help': 'Projectors are notorious for not having good contrast.',
         'id': 'C3000',
         'msg': 'Projectors are notorious for not having good contrast.',
         'msg_name': 'text-readability',
         'page': ''
     }])
     compare(readability.main(msg_info=['W8001']), [])
 def test_checker_helpers(self):
     compare(
         readability.main(msg_info='All'),
         [{'help': 'Projectors are notorious for not having good contrast.',
           'id': 'C3000',
           'msg': 'Projectors are notorious for not having good contrast.',
           'msg_name': 'text-readability',
           'page': ''}])
     compare(
         readability.main(msg_info=['C3000']),
         [{'help': 'Projectors are notorious for not having good contrast.',
           'id': 'C3000',
           'msg': 'Projectors are notorious for not having good contrast.',
           'msg_name': 'text-readability',
           'page': ''}])
     compare(readability.main(msg_info=['W8001']),
             [])
 def test_default_args(self):
     for prefix in ('msoffice', 'libreoffice'):
         target_file = os.path.join(
             here, prefix+'_redability.pdf')
         rez = readability.main(target_file=target_file)
         compare(
             rez,
             [{'help': 'Projectors are notorious for not having good '
                       'contrast. Your text to too close to the '
                       'background color and might be unreadable.',
               'id': 'C3000',
               'msg': 'Low text color to background contrast.',
               'msg_name': 'text-readability',
               'page': 'Slide 1'},
              {'help': 'Projectors are notorious for not having good '
                       'contrast. Your text to too close to the '
                       'background color and might be unreadable.',
               'id': 'C3000',
               'msg': 'Low text color to background contrast.',
               'msg_name': 'text-readability',
               'page': 'Slide 3'},
              {'help': 'Projectors are notorious for not having good '
                       'contrast. Your text to too close to the '
                       'background color and might be unreadable.',
               'id': 'C3000',
               'msg': 'Low text color to background contrast.',
               'msg_name': 'text-readability',
               'page': 'Slide 4'},
              {'help': 'Projectors are notorious for not having good '
                       'contrast. Your text to too close to the '
                       'background color and might be unreadable.',
               'id': 'C3000',
               'msg': 'Low text color to background contrast.',
               'msg_name': 'text-readability',
               'page': 'Slide 5'},
              {'help': 'Projectors are notorious for not having good '
                       'contrast. Your text to too close to the '
                       'background color and might be unreadable.',
               'id': 'C3000',
               'msg': 'Low text color to background contrast.',
               'msg_name': 'text-readability',
               'page': 'Slide 7'},
              {'help': 'Projectors are notorious for not having good '
                       'contrast. Your text to too close to the '
                       'background color and might be unreadable.',
               'id': 'C3000',
               'msg': 'Low text color to background contrast.',
               'msg_name': 'text-readability',
               'page': 'Slide 8'},
              {'help': 'Projectors are notorious for not having good '
                       'contrast. Your text to too close to the '
                       'background color and might be unreadable.',
               'id': 'C3000',
               'msg': 'Low text color to background contrast.',
               'msg_name': 'text-readability',
               'page': 'Slide 10'}])
Example #4
0
 def test_custom_args(self):
     # for prefix in ('msoffice', ):
     # for prefix in ('libreoffice', ):
     for prefix in ('msoffice', 'libreoffice'):
         target_file = os.path.join(here, prefix + '_redability.pdf')
         rez = readability.main(
             target_file=target_file,
             scale_regress=1.5,
             max_similarity=0.1,
             cross_range=50,
             scale_waight=1,
         )
         compare(rez, [{
             'help':
             'Projectors are notorious for not having good '
             'contrast. Your text to too close to the '
             'background color and might be unreadable.',
             'id':
             'C3000',
             'msg':
             'Low text color to background contrast.',
             'msg_name':
             'text-readability',
             'page':
             'Slide 5'
         }, {
             'help':
             'Projectors are notorious for not having good '
             'contrast. Your text to too close to the '
             'background color and might be unreadable.',
             'id':
             'C3000',
             'msg':
             'Low text color to background contrast.',
             'msg_name':
             'text-readability',
             'page':
             'Slide 7'
         }, {
             'help':
             'Projectors are notorious for not having good '
             'contrast. Your text to too close to the '
             'background color and might be unreadable.',
             'id':
             'C3000',
             'msg':
             'Low text color to background contrast.',
             'msg_name':
             'text-readability',
             'page':
             'Slide 10'
         }])
 def test_custom_args(self):
     # for prefix in ('msoffice', ):
     # for prefix in ('libreoffice', ):
     for prefix in ('msoffice', 'libreoffice'):
         target_file = os.path.join(
             here, prefix+'_redability.pdf')
         rez = readability.main(
             target_file=target_file,
             scale_regress=1.5,
             max_similarity=0.1,
             cross_range=50,
             scale_waight=1,
         )
         compare(
             rez,
             [{'help': 'Projectors are notorious for not having good '
                       'contrast. Your text to too close to the '
                       'background color and might be unreadable.',
               'id': 'C3000',
               'msg': 'Low text color to background contrast.',
               'msg_name': 'text-readability',
               'page': 'Slide 5'},
              {'help': 'Projectors are notorious for not having good '
                       'contrast. Your text to too close to the '
                       'background color and might be unreadable.',
               'id': 'C3000',
               'msg': 'Low text color to background contrast.',
               'msg_name': 'text-readability',
               'page': 'Slide 7'},
              {'help': 'Projectors are notorious for not having good '
                       'contrast. Your text to too close to the '
                       'background color and might be unreadable.',
               'id': 'C3000',
               'msg': 'Low text color to background contrast.',
               'msg_name': 'text-readability',
               'page': 'Slide 10'}])
Example #6
0
 def test_default_args(self):
     for prefix in ('msoffice', 'libreoffice'):
         target_file = os.path.join(here, prefix + '_redability.pdf')
         rez = readability.main(target_file=target_file)
         compare(rez, [{
             'help':
             'Projectors are notorious for not having good '
             'contrast. Your text to too close to the '
             'background color and might be unreadable.',
             'id':
             'C3000',
             'msg':
             'Low text color to background contrast.',
             'msg_name':
             'text-readability',
             'page':
             'Slide 1'
         }, {
             'help':
             'Projectors are notorious for not having good '
             'contrast. Your text to too close to the '
             'background color and might be unreadable.',
             'id':
             'C3000',
             'msg':
             'Low text color to background contrast.',
             'msg_name':
             'text-readability',
             'page':
             'Slide 3'
         }, {
             'help':
             'Projectors are notorious for not having good '
             'contrast. Your text to too close to the '
             'background color and might be unreadable.',
             'id':
             'C3000',
             'msg':
             'Low text color to background contrast.',
             'msg_name':
             'text-readability',
             'page':
             'Slide 4'
         }, {
             'help':
             'Projectors are notorious for not having good '
             'contrast. Your text to too close to the '
             'background color and might be unreadable.',
             'id':
             'C3000',
             'msg':
             'Low text color to background contrast.',
             'msg_name':
             'text-readability',
             'page':
             'Slide 5'
         }, {
             'help':
             'Projectors are notorious for not having good '
             'contrast. Your text to too close to the '
             'background color and might be unreadable.',
             'id':
             'C3000',
             'msg':
             'Low text color to background contrast.',
             'msg_name':
             'text-readability',
             'page':
             'Slide 7'
         }, {
             'help':
             'Projectors are notorious for not having good '
             'contrast. Your text to too close to the '
             'background color and might be unreadable.',
             'id':
             'C3000',
             'msg':
             'Low text color to background contrast.',
             'msg_name':
             'text-readability',
             'page':
             'Slide 8'
         }, {
             'help':
             'Projectors are notorious for not having good '
             'contrast. Your text to too close to the '
             'background color and might be unreadable.',
             'id':
             'C3000',
             'msg':
             'Low text color to background contrast.',
             'msg_name':
             'text-readability',
             'page':
             'Slide 10'
         }])