How to use the nose.tools.assert_is_instance 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 niftools / blender_nif_plugin / testframework / integration / modules / property / texture / n_gen_texture.py View on Github external
def n_check_source_texture(n_nisourcetexture, n_texture_path):
    nose.tools.assert_is_instance(n_nisourcetexture, NifFormat.NiSourceTexture)
    n_split_path = n_texture_path.split(path.sep)
    n_rel_path = n_split_path[len(n_split_path) - 3:]  # get a path relative to \\textures folder
    n_src_path = n_nisourcetexture.file_name.decode()
    n_src_path = n_src_path.split(path.sep)
    nose.tools.assert_equal(n_src_path, n_rel_path)
github CenterForOpenScience / osf.io / admin_tests / users / test_serializers.py View on Github external
def test_serialize_two_factor(self):
        user = UserFactory()
        info = serialize_user(user)
        nt.assert_false(info['two_factor'])
        user.get_or_add_addon('twofactor')
        info = serialize_user(user)
        nt.assert_is_instance(info, dict)
        nt.assert_equal(info['name'], user.fullname)
        nt.assert_equal(list(info['emails']), list(user.emails.values_list('address', flat=True)))
        nt.assert_equal(info['last_login'], user.date_last_login)
        nt.assert_equal(len(info['nodes']), 0)
        nt.assert_true(info['two_factor'])
github angr / angr / tests / test_types.py View on Github external
def test_parse_type():
    int_ptr = angr.types.parse_type('int *')
    nose.tools.assert_is_instance(int_ptr, SimTypePointer)
    nose.tools.assert_is_instance(int_ptr.pts_to, SimTypeInt)

    char_ptr = angr.types.parse_type('char *c')
    nose.tools.assert_is_instance(char_ptr, SimTypePointer)
    nose.tools.assert_is_instance(char_ptr.pts_to, SimTypeChar)

    struct_parse_type = angr.types.parse_type('struct parse_type { char c; float f; }')
    nose.tools.assert_is_instance(struct_parse_type, SimStruct)
    nose.tools.assert_equal(struct_parse_type.name, 'parse_type')
    nose.tools.assert_equal(len(struct_parse_type.fields), 2)
    nose.tools.assert_is_instance(struct_parse_type.fields['c'], SimTypeChar)
    nose.tools.assert_is_instance(struct_parse_type.fields['f'], SimTypeFloat)

    union_dcba = angr.types.parse_type('union dcba { double d; long long int lli; }')
    nose.tools.assert_is_instance(union_dcba, SimUnion)
    nose.tools.assert_equal(union_dcba.name, 'dcba')
    nose.tools.assert_equal(len(union_dcba.members), 2)
    nose.tools.assert_is_instance(union_dcba.members['d'], SimTypeDouble)
    nose.tools.assert_is_instance(union_dcba.members['lli'], SimTypeLongLong)

    struct_llist = angr.types.parse_type('struct llist { int data; struct llist * next; }')
    nose.tools.assert_is_instance(struct_llist, SimStruct)
    nose.tools.assert_equal(struct_llist.name, 'llist')
    nose.tools.assert_equal(len(struct_llist.fields), 2)
    nose.tools.assert_is_instance(struct_llist.fields['data'], SimTypeInt)
    nose.tools.assert_is_instance(struct_llist.fields['next'], SimTypePointer)
    nose.tools.assert_is_instance(struct_llist.fields['next'].pts_to, SimStruct)
github CenterForOpenScience / osf.io / admin_tests / spam / test_views.py View on Github external
def test_get_context_data(self):
        self.view.object_list = self.view.get_queryset()
        res = self.view.get_context_data()
        nt.assert_is_instance(res['spam'], list)
        nt.assert_is_instance(res['spam'][0], dict)
        nt.assert_equal(res['status'], '1')
        nt.assert_equal(res['page_number'], 1)
        nt.assert_equal(res['user_id'], self.user_1._id)
github python-happybase / happybase / tests / test_api.py View on Github external
def test_families():
    families = table.families()
    for name, fdesc in six.iteritems(families):
        assert_is_instance(name, bytes)
        assert_is_instance(fdesc, dict)
        assert_in('name', fdesc)
        assert_is_instance(fdesc['name'], six.binary_type)
        assert_in('max_versions', fdesc)
github QuantEcon / QuantEcon.lectures.code / solow / tests_solow / test_impulse_response.py View on Github external
def test_plot_efficiency_units_impulse_response():
    """Testing return type for plot_impulse_response."""
    original_params = {'A0': 1.0, 'g': 0.02, 'L0': 1.0, 'n': 0.02, 's': 0.15,
                       'alpha': 0.33, 'delta': 0.05}
    model = cobb_douglas.CobbDouglasModel(original_params)

    # initialize the impulse
    model.irf.impulse = {'delta': 0.25}
    model.irf.kind = 'efficiency_units'

    fig, ax = plt.subplots(1, 1)
    tmp_lines = model.irf.plot_impulse_response(ax, variable='output')
    nose.tools.assert_is_instance(tmp_lines, list)
github airbnb / streamalert / tests / unit / stream_alert_rule_processor / test_parsers.py View on Github external
'columns': {
                'test-column': 1
            },
            'valid': 'true'
        })
        parsed_result = self.parser_helper(data=data,
                                           schema=schema,
                                           options=options)

        # tests
        assert_equal(parsed_result[0]['host'], 'unit-test-host-1')
        assert_equal(parsed_result[0]['valid'], 'true')

        # test optional fields
        assert_equal(parsed_result[0]['host-id'], 0)
        assert_is_instance(parsed_result[0]['ids'], list)
        assert_is_instance(parsed_result[0]['results'], dict)
github nigroup / nideep / nideep / datasets / nyudv2 / test_nyudv2_to_lmdb.py View on Github external
imgs = np.expand_dims(x, axis=1).astype(float)
        imgs = np.tile(imgs, (3, 1, 1))

        dat = {n2l.NYUDV2DataType.IMAGES : imgs,
               n2l.NYUDV2DataType.LABELS : x.astype(int) + 1,
               n2l.NYUDV2DataType.DEPTHS : x.astype(float) + 2
               }

        p = os.path.join(self.dir_tmp, 'foo.mat')
        io.savemat(p, dat)

        prefix = 'xyz_'
        lmdb_info = n2l.nyudv2_to_lmdb(p, prefix, self.dir_tmp)

        assert_is_instance(lmdb_info, list)

        for info_ in lmdb_info:

            n = info_[0]
            plmdb = info_[-1]

            assert_true(os.path.isdir(plmdb))

            if 'val' in os.path.basename(plmdb):
                assert_equal(n, 0)
github CenterForOpenScience / osf.io / admin_tests / users / test_serializers.py View on Github external
def test_serialize_user(self):
        user = UserFactory()
        info = serialize_user(user)
        nt.assert_is_instance(info, dict)
        nt.assert_equal(info['name'], user.fullname)
        nt.assert_equal(info['id'], user._id)
        nt.assert_equal(list(info['emails']), list(user.emails.values_list('address', flat=True)))
        nt.assert_equal(info['last_login'], user.date_last_login)
        nt.assert_equal(len(info['nodes']), 0)
github angr / angr / tests / test_types.py View on Github external
def test_parse_type():
    int_ptr = angr.types.parse_type('int *')
    nose.tools.assert_is_instance(int_ptr, SimTypePointer)
    nose.tools.assert_is_instance(int_ptr.pts_to, SimTypeInt)

    char_ptr = angr.types.parse_type('char *c')
    nose.tools.assert_is_instance(char_ptr, SimTypePointer)
    nose.tools.assert_is_instance(char_ptr.pts_to, SimTypeChar)

    struct_parse_type = angr.types.parse_type('struct parse_type { char c; float f; }')
    nose.tools.assert_is_instance(struct_parse_type, SimStruct)
    nose.tools.assert_equal(struct_parse_type.name, 'parse_type')
    nose.tools.assert_equal(len(struct_parse_type.fields), 2)
    nose.tools.assert_is_instance(struct_parse_type.fields['c'], SimTypeChar)
    nose.tools.assert_is_instance(struct_parse_type.fields['f'], SimTypeFloat)

    union_dcba = angr.types.parse_type('union dcba { double d; long long int lli; }')
    nose.tools.assert_is_instance(union_dcba, SimUnion)
    nose.tools.assert_equal(union_dcba.name, 'dcba')