35047

How use pipe character inside Examples table of Behave test .feature file?

<h3>Question</h3>

I have a Behave Scenario outline where I need to use pipe character - | as a cell value inside Examples table. But I don't know how to escape this character to not be treated as column separator. I'm getting Malformed table error when I try to use \| sequence.


<h3>Answer1:</h3>

As far as I can tell, it is not possible to escape cell delimiters as of version 1.2.5 (current at the time of posting). The relevant code is in the action_table method. This is how it splits a line into cells:

cells = [cell.strip() for cell in line.split('|')[1:-1]]

I searched before and after this line but did not see code that would transform sequences like \| or anything similar into something that .split('|') would not affect.

The only solution I see, as of 1.2.5, would be to hand-code the content of your cells so that you use another character than | in the cell data and then convert it to | in your Python code. For instance, using !, you could have in the feature file:

| foo!bar |

and then convert ! to | in your step implementations. This is awful but I don't see another way to get what you want.

来源:https://stackoverflow.com/questions/34357982/how-use-pipe-character-inside-examples-table-of-behave-test-feature-file

Recommend

  • Asking user to enter the input again after he gives a wrong value for the Input. InputMismatchExcept
  • How to trigger 'contenteditable' element into edit state using js?
  • Crash analytics and reporting for iOS [closed]
  • LINQ to Entities does not recognize method
  • Get demographic information from bigquery connected with firebase analytics
  • How to remove a column from excel sheet in epplus
  • Nuget crash in visual studio 2015
  • AzureMobileService: Insert data in to table gives exception
  • Keras metric produces unexpected values
  • Vertica: how can you concate values by some order?
  • How to make Expiring/Signed video embed urls
  • check the difference between two arrays of objects in javascript
  • Random Background Color Change
  • How to pass the object from one controller to another in Spring without using Session
  • Run a function after all partials (ng-includes) loaded
  • Python: Why am I getting a UnicodeDecodeError?
  • Count of values within specified range of value in each row using data.table
  • How to create 2 svg's on one page?
  • Php artisan optimize is failing on production server
  • How to put an object in the air?
  • Sample deviceQuery cuda program
  • Android studio import problems. (Apktool)
  • playing mp3 from nsbundle
  • Building JavaFX 2.0 App on Mac, deploying on Windows
  • Create an Office365 mailbox from within C# Web API method
  • Autocomplete source from project settings
  • How to make 100% div height between header and footer?
  • I am consuming a WCF service that requires headers from a .NET 2 website. How can I programmatically
  • Terminal run dalvikvm with am.jar
  • How to specify generic type when the type is only known at runtime?
  • How to integrate angular2-material (alpha 8.2) with angular2-Quickstart app
  • matrix multiplication apache pig
  • Google App Engine backend servlet not responding
  • Make checkout phone field optional for specific countries in WooCommerce
  • Excel VBA : conditional formatting of sheet1 cells from sheet2 values in excel 2007
  • Android Library Projects on Windows and Mac
  • Angular FormGroup won't update it's value immediately after patchValue or setValue
  • How to use FirstOrDefault inside Include
  • ARKit code issue {unknown error -1=ffffffffffffffff error: Task failed with exit 1}
  • Time Complexity of Fibonacci Algorithm [duplicate]