Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
@raises(ValueError)
def test_run_experiment_lr_with_length_as_feature_name():
# rsmtool experiment with 'length' used as feature name
# when a length analysis is requested using a different feature
source = 'lr-with-length-as-feature-name'
experiment_id = 'lr_with_length_as_feature_name'
config_file = join(test_dir,
'data',
'experiments',
source,
'{}.json'.format(experiment_id))
do_run_experiment(source, experiment_id, config_file)
@raises(Exception)
def test_unknown_sheet(self):
importer = SQLTableImporter(None)
category_adapter = SQLTableImportAdapter(Category)
category_adapter.column_names = [""]
importer.append(category_adapter)
writer = SQLBookWriter()
writer.open_content(importer)
to_store = OrderedDict()
to_store.update({"you do not see me": [[]]})
writer.write(to_store)
@raises(IndexError)
def test_resolve_metadata_duplicates_metadata_missing_index(self):
"""
TestMetadata: Check if metadata with a missing index will throw an error
"""
metadata.resolve_metadata_duplicates({})
@raises(ValueError)
def test_no_row_id_throws_error_when_missing_default_field():
features = df_titanic_test.iloc[0].to_dict()
print('features')
print(features)
del features['name']
assert 'name' not in features
assert 'row_id' not in features
check_row_id_result = concord.check_row_id(val=features, row_id=None)
assert False
@raises(TypeError)
def test_password_field_to_son_wrong_value(self):
field = PasswordField()
field.to_son(5)
@raises(NoAvailableCopies)
def test_checkout_not_available(self):
"""Test that the correct exception is thrown upon an unsuccessful login."""
data = self.get_data("no_copies.json")
self.api.queue_response(200, content=data)
result = json.loads(data)
edition, pool = self._edition(
identifier_type=Identifier.ENKI_ID,
data_source_name=DataSource.ENKI,
with_license_pool=True
)
pool.identifier.identifier = 'econtentRecord1'
patron = self._patron(external_identifier='12345678901234')
loan = self.api.checkout(patron,'1234',pool,None)
@raises(TypeError)
def test_variable_filter_roles_error():
# Creating computation graph
brick1 = Linear(input_dim=2, output_dim=2, name='linear1')
x = tensor.vector()
h1 = brick1.apply(x)
cg = ComputationGraph(h1)
# testing role error
VariableFilter(roles=PARAMETER)(cg.variables)
@raises(TypeError)
def test_registration_with_none_value():
rc = RouteConverter()
rc.convert()
@nose.tools.raises(transmission.BadRequest)
def test_unsuccessful_request(self):
"""
Any unsuccessful request raises BadRequest.
"""
with mock.patch("json.loads") as mocked:
mocked.return_value = {"result": "failure"}
self.client._deserialize_response(mock.MagicMock())