##// END OF EJS Templates
don't skip doctest
Paul Ivanov -
Show More
@@ -19,7 +19,6 b' except ImportError:'
19 19 # Python 2 backport
20 20 from pathlib2 import Path
21 21
22 from IPython.testing.skipdoctest import skip_doctest
23 22 from IPython.utils import py3compat
24 23
25 24 # datetime.strftime date format for ipython
@@ -516,7 +515,6 b' class EvalFormatter(Formatter):'
516 515 # inside [], so EvalFormatter can handle slicing. Once we only support 3.4 and
517 516 # above, it should be possible to remove FullEvalFormatter.
518 517
519 @skip_doctest
520 518 class FullEvalFormatter(Formatter):
521 519 """A String Formatter that allows evaluation of simple expressions.
522 520
@@ -532,13 +530,13 b' class FullEvalFormatter(Formatter):'
532 530
533 531 In [1]: f = FullEvalFormatter()
534 532 In [2]: f.format('{n//4}', n=8)
535 Out[2]: u'2'
533 Out[2]: '2'
536 534
537 535 In [3]: f.format('{list(range(5))[2:4]}')
538 Out[3]: u'[2, 3]'
536 Out[3]: '[2, 3]'
539 537
540 538 In [4]: f.format('{3*2}')
541 Out[4]: u'6'
539 Out[4]: '6'
542 540 """
543 541 # copied from Formatter._vformat with minor changes to allow eval
544 542 # and replace the format_spec code with slicing
@@ -573,7 +571,6 b' class FullEvalFormatter(Formatter):'
573 571 return u''.join(py3compat.cast_unicode(s) for s in result)
574 572
575 573
576 @skip_doctest
577 574 class DollarFormatter(FullEvalFormatter):
578 575 """Formatter allowing Itpl style $foo replacement, for names and attribute
579 576 access only. Standard {foo} replacement also works, and allows full
@@ -585,13 +582,13 b' class DollarFormatter(FullEvalFormatter):'
585 582
586 583 In [1]: f = DollarFormatter()
587 584 In [2]: f.format('{n//4}', n=8)
588 Out[2]: u'2'
585 Out[2]: '2'
589 586
590 587 In [3]: f.format('23 * 76 is $result', result=23*76)
591 Out[3]: u'23 * 76 is 1748'
588 Out[3]: '23 * 76 is 1748'
592 589
593 590 In [4]: f.format('$a or {b}', a=1, b=2)
594 Out[4]: u'1 or 2'
591 Out[4]: '1 or 2'
595 592 """
596 593 _dollar_pattern = re.compile("(.*?)\$(\$?[\w\.]+)")
597 594 def parse(self, fmt_string):
General Comments 0
You need to be logged in to leave comments. Login now