text stringlengths 0 828 |
|---|
LogRecordTable.annotate_with_row_schema(context.table, record_schema) |
step_command_output_should_not_contain_log_records(context) |
context.table.remove_columns([""level"", ""message""])" |
1887,"def step_file_should_contain_log_records(context, filename): |
"""""" |
Verifies that the command output contains the specified log records |
(in any order). |
.. code-block: gherkin |
Then the file ""xxx.log"" should contain the log records: |
| category | level | message | |
| bar | CURRENT | xxx | |
"""""" |
assert context.table, ""REQUIRE: context.table"" |
context.table.require_columns([""category"", ""level"", ""message""]) |
format = getattr(context, ""log_record_format"", context.config.logging_format) |
for row in context.table.rows: |
output = LogRecordTable.make_output_for_row(row, format) |
context.text = output |
step_file_should_contain_multiline_text(context, filename)" |
1888,"def step_file_should_not_contain_log_records(context, filename): |
"""""" |
Verifies that the command output contains the specified log records |
(in any order). |
.. code-block: gherkin |
Then the file ""xxx.log"" should not contain the log records: |
| category | level | message | |
| bar | CURRENT | xxx | |
"""""" |
assert context.table, ""REQUIRE: context.table"" |
context.table.require_columns([""category"", ""level"", ""message""]) |
format = getattr(context, ""log_record_format"", context.config.logging_format) |
for row in context.table.rows: |
output = LogRecordTable.make_output_for_row(row, format) |
context.text = output |
step_file_should_not_contain_multiline_text(context, filename)" |
1889,"def step_use_log_record_configuration(context): |
"""""" |
Define log record configuration parameters. |
.. code-block: gherkin |
Given I use the log record configuration: |
| property | value | |
| format | | |
| datefmt | | |
"""""" |
assert context.table, ""REQUIRE: context.table"" |
context.table.require_columns([""property"", ""value""]) |
for row in context.table.rows: |
property_name = row[""property""] |
value = row[""value""] |
if property_name == ""format"": |
context.log_record_format = value |
elif property_name == ""datefmt"": |
context.log_record_datefmt = value |
else: |
raise KeyError(""Unknown property=%s"" % property_name)" |
1890,"def annotate_with_row_schema(table, row_schema): |
"""""" |
Annotate/extend a table of log-records with additional columns from |
the log-record schema if columns are missing. |
:param table: Table w/ log-records (as :class:`behave.model.Table`) |
:param row_schema: Log-record row schema (as dict). |
"""""" |
for column, value in row_schema.items(): |
if column not in table.headings: |
table.add_column(column, default_value=value)" |
1891,"def smart_decode(binary, errors=""strict""): |
"""""" |
Automatically find the right codec to decode binary data to string. |
:param binary: binary data |
:param errors: one of 'strict', 'ignore' and 'replace' |
:return: string |
"""""" |
d = chardet.detect(binary) |
encoding = d[""encoding""] |
confidence = d[""confidence""] |
text = binary.decode(encoding, errors=errors) |
return text, encoding, confidence" |
1892,"def decode(self, binary, url, encoding=None, errors=""strict""): |
"""""" |
Decode binary to string. |
:param binary: binary content of a http request. |
:param url: endpoint of the request. |
:param encoding: manually specify the encoding. |
:param errors: errors handle method. |
:return: str |
"""""" |
if encoding is None: |
domain = util.get_domain(url) |
if domain in self.domain_encoding_table: |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.