Closed keroro824 closed 10 years ago
That's because you used the same quote char to wrap the string as there are quote chars inside it, so it breaks: "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")"
I sense you are getting tired -- you should get a good night's sleep now!
I tried ' ' but it did not work either
it even failed in command line
The string also contains '
characters. So you could make all the internal quotes the same, or you could use triple quotes in Python.
:first_quarter_moon_with_face: :sleeping: :grey_exclamation: :smile:
Good Night!
Can you also look at this one please :)
All the tests pass now? If so :+1: merge away.
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