Example #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('')
Example #2
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('')
Example #3
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')
Example #4
0
	def test_undefined_code(self):
		with self.assertRaises(SyntaxError):
			antsy.decorate('Well (this is not going to work)')
Example #5
0
	def test_delimiters_same(self):
		with self.assertRaises(SyntaxError):
			antsy.decorate('This will fail', start='!', end='!')
Example #6
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'])
Example #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'])
Example #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')
Example #9
0
 def test_undefined_code(self):
     with self.assertRaises(SyntaxError):
         antsy.decorate('Well (this is not going to work)')
Example #10
0
 def test_delimiters_same(self):
     with self.assertRaises(SyntaxError):
         antsy.decorate('This will fail', start='!', end='!')