예제 #1
0
def print_demo():
    print('All tests finished, printing manual verification page...\n')
    # Some manual formatting tests
    print(
        antsy.decorate(
            'Some text and then (bold bold text and then (fg/red bold red text) now bold) and normal'
        ))
    print(
        antsy.decorate(
            '(b bold) (d dim) (i italic) (u underline) (b,fg/red DANGER) (bg/green,i,u,fg/yellow CRAZY)'
        ))
    print(
        antsy.decorate(
            'Different delimiters here (because this text has [fg/red parentheses] in it)',
            start='[',
            end=']'))
    # The table
    print(
        antsy.decorate(
            ''.join(['        '] +
                    ['(fg/{} {})'.format(c, c.ljust(8))
                     for c in antsy.COLORS])))
    for bgc in antsy.COLORS:
        sys.stdout.write(
            antsy.decorate('(bg/{} {}) '.format(bgc, bgc.ljust(7))))
        for fgc in antsy.COLORS:
            sys.stdout.write(
                antsy.decorate('(bg/{}  (fg/{} (d X) X (b X)) ) '.format(
                    bgc, fgc)))
        sys.stdout.write('\n')
    # Some room for the table to breathe
    print('')
예제 #2
0
파일: test.py 프로젝트: willyg302/antsy
def print_demo():
	print('All tests finished, printing manual verification page...\n')
	# Some manual formatting tests
	print(antsy.decorate('Some text and then (bold bold text and then (fg/red bold red text) now bold) and normal'))
	print(antsy.decorate('(b bold) (d dim) (i italic) (u underline) (b,fg/red DANGER) (bg/green,i,u,fg/yellow CRAZY)'))
	print(antsy.decorate('Different delimiters here (because this text has [fg/red parentheses] in it)', start='[', end=']'))
	# The table
	print(antsy.decorate(''.join(['        '] + ['(fg/{} {})'.format(c, c.ljust(8)) for c in antsy.COLORS])))
	for bgc in antsy.COLORS:
		sys.stdout.write(antsy.decorate('(bg/{} {}) '.format(bgc, bgc.ljust(7))))
		for fgc in antsy.COLORS:
			sys.stdout.write(antsy.decorate('(bg/{}  (fg/{} (d X) X (b X)) ) '.format(bgc, fgc)))
		sys.stdout.write('\n')
	# Some room for the table to breathe
	print('')
예제 #3
0
파일: test.py 프로젝트: willyg302/antsy
	def test_not_supports_color(self):
		with support(False):
			actual = antsy.decorate('This (bold should) (i go through (bg/green unchanged))')
			self.assertEqual(actual, 'This should go through unchanged')
예제 #4
0
파일: test.py 프로젝트: willyg302/antsy
	def test_undefined_code(self):
		with self.assertRaises(SyntaxError):
			antsy.decorate('Well (this is not going to work)')
예제 #5
0
파일: test.py 프로젝트: willyg302/antsy
	def test_delimiters_same(self):
		with self.assertRaises(SyntaxError):
			antsy.decorate('This will fail', start='!', end='!')
예제 #6
0
파일: test.py 프로젝트: willyg302/antsy
	def run_spec(self, d, start='(', end=')'):
		self.assertEqual(antsy.decorate(d['actual'], start=start, end=end), d['on'])
		with support(False):
			self.assertEqual(antsy.decorate(d['actual'], start=start, end=end), d['off'])
예제 #7
0
 def run_spec(self, d, start='(', end=')'):
     self.assertEqual(antsy.decorate(d['actual'], start=start, end=end),
                      d['on'])
     with support(False):
         self.assertEqual(antsy.decorate(d['actual'], start=start, end=end),
                          d['off'])
예제 #8
0
 def test_not_supports_color(self):
     with support(False):
         actual = antsy.decorate(
             'This (bold should) (i go through (bg/green unchanged))')
         self.assertEqual(actual, 'This should go through unchanged')
예제 #9
0
 def test_undefined_code(self):
     with self.assertRaises(SyntaxError):
         antsy.decorate('Well (this is not going to work)')
예제 #10
0
 def test_delimiters_same(self):
     with self.assertRaises(SyntaxError):
         antsy.decorate('This will fail', start='!', end='!')