Estoy creando una aplicación de lista de tareas pendientes y uno de los comandos en esta aplicación es imprimir la ayuda aquí está mi código:
@app.command() def help(): y="""""Usage :-\n $ ./task add 2 hello world\t # Add a new item with priority 2 and text \"hello world\" to the list\n $ ./task ls\t # Show incomplete priority list items sorted by priority in ascending order $ ./task del INDEX\t # Delete the incomplete item with the given index\n $ ./task done INDEX\t # Mark the incomplete item with the given index as complete\n $ ./task help\t # Show usage\n $ ./task report\t # Statistics""" print(y)Cuando ejecuto este código, obtengo el resultado normal que se puede imaginar. Pero cuando ejecuto la prueba de automatización de npm proporcionada por mi pasantía, recibo un resultado diferente.
Aquí están los resultados esperados y recibidos:
Expected: StringContaining "Usage :- $ ./task add 2 hello world # Add a new item with priority 2 and text \"hello world\" to the list $ ./task ls # Show incomplete priority list items sorted by priority in ascending order $ ./task del INDEX # Delete the incomplete item with the given index $ ./task done INDEX # Mark the incomplete item with the given index as complete $ ./task help # Show usage $ ./task report # Statistics" Received: "Usage :-··· $ ./task add 2 hello world # Add a new item with priority 2 and text \"hello world\" to the list··· $ ./task ls # Show incomplete priority list items sorted by priority in ascending order··· $ ./task del INDEX # Delete the incomplete item with the given index··· $ ./task done INDEX # Mark the incomplete item with the given index as complete··· $ ./task help # Show usage··· $ ./task report # Statistics· "Como puede ver, obtengo estos puntos extraños en mi salida mientras ejecuto pruebas npm. Cualquier ayuda en esto sería apreciada.