Skip to content

Commit

Permalink
Merge pull request #529 from tisnik/remove-unicode-literals-from-string
Browse files Browse the repository at this point in the history
Removed Unicode prefixes from string literals
  • Loading branch information
tisnik authored Nov 7, 2023
2 parents 2101ffd + 85c7251 commit 744f414
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 29 deletions.
12 changes: 6 additions & 6 deletions features/steps/cleaner_storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
from common_aggregator import DB_TABLES


@given(u"the database is empty")
@then(u"the database is empty")
@then(u"I should find that the database is empty")
@given("the database is empty")
@then("the database is empty")
@then("I should find that the database is empty")
def ensure_database_emptiness(context):
"""Perform check if the database is empty."""
cursor = context.connection.cursor()
Expand All @@ -37,7 +37,7 @@ def ensure_database_emptiness(context):
context.connection.rollback()


@then(u"I should find that all tables are empty")
@then("I should find that all tables are empty")
def ensure_data_tables_emptiness(context):
"""Perform check if data tables are empty."""
for table in DB_TABLES:
Expand All @@ -53,7 +53,7 @@ def ensure_data_tables_emptiness(context):
raise


@when(u"I delete all tables from database")
@when("I delete all tables from database")
def delete_all_tables(context):
"""Delete all relevant tables from database."""
for table in DB_TABLES:
Expand All @@ -66,7 +66,7 @@ def delete_all_tables(context):
raise


@when(u"I insert following records into {table} table")
@when("I insert following records into {table} table")
def insert_records_into_selected_table(context, table):
"""Insert provided records into specified table."""
cursor = context.connection.cursor()
Expand Down
2 changes: 1 addition & 1 deletion features/steps/common_aggregator.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@
)


@when(u"I prepare database schema")
@when("I prepare database schema")
def prepare_database_schema(context):
"""Prepare database schema."""
cursor = context.connection.cursor()
Expand Down
24 changes: 12 additions & 12 deletions features/steps/common_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,28 +20,28 @@
from behave import given, when, then


@given(u"the database is named {name}")
@given("the database is named {name}")
def given_database_name(context, name):
"""Set the database name."""
assert name != "", "Database name should be specified"
context.database_name = name


@given(u"database user is set to {user}")
@given("database user is set to {user}")
def given_database_user(context, user):
"""Set the database user name."""
assert user != "", "Database user name should be specified"
context.database_user = user


@given(u"database password is set to {password}")
@given("database password is set to {password}")
def given_database_password(context, password):
"""Set the database user password."""
assert password != "", "Database user password should be specified"
context.database_password = password


@when(u"I connect to database named {database} as user {user} with password {password}")
@when("I connect to database named {database} as user {user} with password {password}")
def connect_to_database(context, database, user, password):
"""Perform connection to selected database."""
connection_string = "dbname={} user={} password={} host={} port={}".format(
Expand All @@ -50,27 +50,27 @@ def connect_to_database(context, database, user, password):
context.connection = psycopg2.connect(connection_string)


@then(u"I should be able to connect to such database")
@then("I should be able to connect to such database")
def check_connection(context):
"""Check the connection to database."""
assert context.connection is not None, "connection should be established"


@when(u"I close database connection")
@when("I close database connection")
def disconnect_from_database(context):
"""Close the connection to database."""
context.connection.close()
context.connection = None


@then(u"I should be disconnected")
@then("I should be disconnected")
def check_disconnection(context):
"""Check that the connection has been closed."""
assert context.connection is None, "connection should be closed"


@given(u"database connection is established")
@when(u"database connection is established")
@given("database connection is established")
@when("database connection is established")
def establish_connection_to_database(context):
"""Perform connection to selected database."""
assert context.database_name is not None
Expand All @@ -89,7 +89,7 @@ def establish_connection_to_database(context):
assert context.connection is not None, "connection should be established"


@when(u"I look for the table {table} in database")
@when("I look for the table {table} in database")
def look_for_table(context, table):
"""Try to find a table in database."""
cursor = context.connection.cursor()
Expand All @@ -103,13 +103,13 @@ def look_for_table(context, table):
context.connection.commit()


@then(u"I should be able to find it")
@then("I should be able to find it")
def check_table_existence(context):
"""Check the table existence in the database."""
assert context.table_found is True, "table should exist"


@then(u"I should not be able to find it")
@then("I should not be able to find it")
def check_table_non_existence(context):
"""Check the table existence in the database."""
assert context.table_found is False, "table should not exist"
Expand Down
6 changes: 3 additions & 3 deletions features/steps/exporter_csv.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
from src.csv_checks import check_table_content


@then(u"I should see following number of records stored in CSV files")
@then("I should see following number of records stored in CSV files")
def number_of_records_in_csv(context):
"""Check if number of records stored in CSV files match expected number."""
# iterate over all items in feature table
Expand All @@ -48,10 +48,10 @@ def number_of_records_in_csv(context):


@then(
u"I should see following records in exported file {filename} placed in column {column:d}"
"I should see following records in exported file {filename} placed in column {column:d}"
)
@then(
u"I should see following records in exported file {filename} placed in columns "
"I should see following records in exported file {filename} placed in columns "
"{column:d} and {column2:d}"
) # noqa: E501
def check_records_in_csv(context, filename, column, column2=None):
Expand Down
2 changes: 1 addition & 1 deletion features/steps/exporter_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from behave import then


@then(u"I should see following files generated")
@then("I should see following files generated")
def check_generated_files(context):
"""Check that all specified files was generated."""
# iterate over all items in feature table
Expand Down
6 changes: 3 additions & 3 deletions features/steps/exporter_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
from behave import when, then


@when(u"I run the exporter with the {flag} command line flag")
@when("I run the exporter with the {flag} command line flag")
def run_exporter_with_flag(context, flag):
"""Start the exporter with given command-line flag."""
out = subprocess.Popen(
Expand All @@ -37,7 +37,7 @@ def run_exporter_with_flag(context, flag):
process_generated_output(context, out, 2)


@when(u"I run the exporter with the following command line flags: {flags}")
@when("I run the exporter with the following command line flags: {flags}")
def run_exporter_with_flags(context, flags):
"""Start the exporter with given command-line flags."""
flags = flags.split(" ")
Expand Down Expand Up @@ -118,7 +118,7 @@ def check_authors_info_from_exporter(context):
), "Caught output: {}".format(context.output)


@then(u"I should see info about configuration displayed by exporter on standard output")
@then("I should see info about configuration displayed by exporter on standard output")
def check_configuration_info_from_exporter(context):
"""Check if information about configuration is displayed by exporter."""
# preliminary checks
Expand Down
6 changes: 3 additions & 3 deletions features/steps/notification_writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def process_ccx_notification_writer_output(context, out, return_code):
context.returncode = out.returncode


@when(u"I start the CCX Notification Writer with the {flag} command line flag")
@when("I start the CCX Notification Writer with the {flag} command line flag")
def start_ccx_notification_writer_with_flag(context, flag):
"""Start the CCX Notification Writer with given command-line flag."""
out = subprocess.Popen(
Expand Down Expand Up @@ -144,7 +144,7 @@ def check_authors_info_from_ccx_notification_writer(context):
), "Caught output: {}".format(context.output)


@then(u"the process should exit with status code set to {expected_code:d}")
@then("the process should exit with status code set to {expected_code:d}")
def check_status_code(context, expected_code):
"""Check the status code of the last started process."""
# check the return code of a process
Expand All @@ -153,7 +153,7 @@ def check_status_code(context, expected_code):
), "Return code is {}, but {} is expected".format(context.returncode, expected_code)


@given(u"CCX Notification database is empty")
@given("CCX Notification database is empty")
def notification_writer_db_empty(context):
"""Ensure that the CCX Notification database is empty, but with all tables."""
# first step - drop all tables, together with theirs content
Expand Down

0 comments on commit 744f414

Please sign in to comment.