one test fail for metadata

Beidi@airbears2-10-142-32-61: ~/Documents/sara/saraResearch/splparser $ splparse "metadata type=sourcetypes index=_internal | rename totalCount as Count firstTime as "First Event" lastTime as "Last Event" recentTime as "Last Update" | fieldformat Count=tostring(Count, "commas") | fieldformat "First Event"=strftime('First Event', "%c") | fieldformat "Last Event"=strftime('Last Event', "%c") | fieldformat "Last Update"=strftime('Last Update', "%c")"
('ROOT')
    ('STAGE')
        ('COMMAND': 'metadata')
            ('EQ': 'assign')
                ('OPTION': 'type')
                ('VALUE': 'sourcetypes')
            ('EQ': 'assign')
                ('DEFAULT_FIELD': 'index')
                ('VALUE': '_internal')
    ('STAGE')
        ('COMMAND': 'rename')
            ('FUNCTION': 'rename')
                ('FIELD': 'totalCount')
                ('FIELD': 'Count')
            ('FUNCTION': 'rename')
                ('FIELD': 'firstTime')
                ('FIELD': 'First')

This test works in command line but failed in test:

File "/Users/Beidi/Documents/sara/saraResearch/splparser/test/splparser/rules/metadatarules/test_metadatarules.txt", line 24, in test_metadatarules.txt
Failed example:
    splparser.parse("metadata type=sourcetypes index=_internal | rename totalCount as Count firstTime as "First Event" lastTime as "Last Event" recentTime as "Last Update" | fieldformat Count=tostring(Count, "commas") | fieldformat "First Event"=strftime('First Event', "%c") | fieldformat "Last Event"=strftime('Last Event', "%c") | fieldformat "Last Update"=strftime('Last Update', "%c")").print_tree()
Exception raised:
    Traceback (most recent call last):
      File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/doctest.py", line 1289, in __run
        compileflags, 1) in test.globs
      File "<doctest test_metadatarules.txt[3]>", line 1
        splparser.parse("metadata type=sourcetypes index=_internal | rename totalCount as Count firstTime as "First Event" lastTime as "Last Event" recentTime as "Last Update" | fieldformat Count=tostring(Count, "commas") | fieldformat "First Event"=strftime('First Event', "%c") | fieldformat "Last Event"=strftime('Last Event', "%c") | fieldformat "Last Update"=strftime('Last Update', "%c")").print_tree()
                                                                                                                  ^
    SyntaxError: invalid syntax