Skip to content

Commit

Permalink
Add proper error when can't select data based on given condition
Browse files Browse the repository at this point in the history
  • Loading branch information
atthaboon committed Mar 27, 2020
1 parent 8ea9cb1 commit 3bce11b
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions ExcelDataDriver/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
from ExcelDataDriver.Config.CaptureScreenShotOption import CaptureScreenShotOption


__version__ = '1.1.5'
__version__ = '1.1.6'


class ExcelDataDriver:
Expand Down Expand Up @@ -579,7 +579,10 @@ def select_reference_data_based_on_condition(self, alias_name, condition):
sheet_name string
properties_list dictionary: access to excel property with lower case and use _ instead of space
"""
self.reference_data[alias_name]['selected'] = next(data for data in self.reference_data[alias_name]['data'] if eval(condition))
try:
self.reference_data[alias_name]['selected'] = next(data for data in self.reference_data[alias_name]['data'] if eval(condition))
except Exception:
raise Exception("Can't select reference data based on condition "+str(condition))

@keyword
def get_selected_reference_data_property(self, alias_name, property_name):
Expand Down

0 comments on commit 3bce11b

Please sign in to comment.