Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_evaluated_expressions(interpreter):
data = Data({"stats": Data(STATS_TO_EVALUATE)})
for expression, result in EXPRESSIONS_TO_EVALUATE:
assert result == interpreter.eval(
expression, data
), 'Expression fails: "%s" != %s' % (expression, result)
def monitor():
monitor = DummyValidationMonitor()
monitor.correct_field_list_handling = True
monitor.data = Data({"stats": stats})
return monitor
def old_monitor():
monitor = DummyValidationMonitor()
monitor.correct_field_list_handling = False
monitor.data = Data({"stats": stats})
return monitor
def data():
return Data(item_scraped_count=150)
def old_monitor_without_attr():
monitor = DummyValidationMonitor()
monitor.data = Data({"stats": stats})
return monitor
def transform_data(self, **data):
data = data or {}
new_data_dict = {}
for attr_name, attr in data.items():
if attr_name in self.data_immutable_dicts:
new_data = Data(attr)
else:
new_data = attr
new_data_dict[attr_name] = new_data
return Data(new_data_dict)
def transform_data(self, **data):
data = data or {}
new_data_dict = {}
for attr_name, attr in data.items():
if attr_name in self.data_immutable_dicts:
new_data = Data(attr)
else:
new_data = attr
new_data_dict[attr_name] = new_data
return Data(new_data_dict)