How to use the nose.tools.raises function in nose

To help you get started, we’ve selected a few nose examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github EducationalTestingService / rsmtool / tests / test_experiment.py View on Github external
@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)
github pyexcel / pyexcel-io / tests / test_sql_book.py View on Github external
@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)
github ministryofjustice / salt-shaker / tests / libs / test_metadata.py View on Github external
    @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({})
github ClimbsRocks / Concordia / tests / test_1_basics.py View on Github external
@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
github ilex / aiomotorengine / tests / fields / test_password_field.py View on Github external
    @raises(TypeError)
    def test_password_field_to_son_wrong_value(self):
        field = PasswordField()
        field.to_son(5)
github NYPL-Simplified / circulation / tests / test_enki.py View on Github external
    @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)
github rizar / attention-lvcsr / tests / test_variable_filter.py View on Github external
@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)
github dfurtado / pyterrier / pyterrier / core / route_converter_tests.py View on Github external
@raises(TypeError)
def test_registration_with_none_value():
    rc = RouteConverter()
    rc.convert()
github edavis / transmission-fluid / tests.py View on Github external
    @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())