本文整理汇总了Python中nose.tools.assert_is_instance函数的典型用法代码示例。如果您正苦于以下问题:Python assert_is_instance函数的具体用法?Python assert_is_instance怎么用?Python assert_is_instance使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了assert_is_instance函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: assert_frame
def assert_frame(s):
""" Check that s is a valid frame.
"""
assert_is_instance(s, Frame)
assert s._kb == ec
assert s.test_frame()
示例2: test_retrun
def test_retrun():
p = return_statement()
node, r = p('return 5')
eq_(r, '')
assert_is_instance(node, Return)
eq_(node.result, NumericLiteral('5'))
示例3: test_slice_types
def test_slice_types(self):
h = HaplotypeArray(haplotype_data, dtype='i1')
# row slice
s = h[1:]
assert_is_instance(s, HaplotypeArray)
# col slice
s = h[:, 1:]
assert_is_instance(s, HaplotypeArray)
# row index
s = h[0]
assert_is_instance(s, np.ndarray)
assert_not_is_instance(s, HaplotypeArray)
# col index
s = h[:, 0]
assert_is_instance(s, np.ndarray)
assert_not_is_instance(s, HaplotypeArray)
# item
s = h[0, 0]
assert_is_instance(s, np.int8)
assert_not_is_instance(s, HaplotypeArray)
示例4: test_self_axes
def test_self_axes(self):
g = ag.FacetGrid(self.df, row="a", col="b", hue="c")
for ax in g.axes.flat:
nt.assert_is_instance(ax, plt.Axes)
plt.close("all")
示例5: test_value
def test_value(module, EXAMPLE):
assert_hasattr(module, 'Value')
assert_is_instance(module.Value, type)
values = EXAMPLE['values']
for value in values:
assert_is_instance(value, module.Value)
示例6: test_list
def test_list():
lis = [lambda x: x, 1]
bufs = serialize_object(lis)
canned = pickle.loads(bufs[0])
nt.assert_is_instance(canned, list)
l2, r = unserialize_object(bufs)
nt.assert_equal(l2[0](l2[1]), lis[0](lis[1]))
示例7: check_basic_figure_sanity
def check_basic_figure_sanity(self, fig, exp_num_subplots, exp_title,
exp_legend_exists, exp_xlabel, exp_ylabel,
exp_zlabel):
# check type
assert_is_instance(fig, mpl.figure.Figure)
# check number of subplots
axes = fig.get_axes()
npt.assert_equal(len(axes), exp_num_subplots)
# check title
ax = axes[0]
npt.assert_equal(ax.get_title(), exp_title)
# shouldn't have tick labels
for tick_label in (ax.get_xticklabels() + ax.get_yticklabels() +
ax.get_zticklabels()):
npt.assert_equal(tick_label.get_text(), '')
# check if legend is present
legend = ax.get_legend()
if exp_legend_exists:
assert_true(legend is not None)
else:
assert_true(legend is None)
# check axis labels
npt.assert_equal(ax.get_xlabel(), exp_xlabel)
npt.assert_equal(ax.get_ylabel(), exp_ylabel)
npt.assert_equal(ax.get_zlabel(), exp_zlabel)
示例8: test_mandates_list
def test_mandates_list():
fixture = helpers.load_fixture('mandates')['list']
helpers.stub_response(fixture)
response = helpers.client.mandates.list(*fixture['url_params'])
body = fixture['body']['mandates']
assert_is_instance(response, list_response.ListResponse)
assert_is_instance(response.records[0], resources.Mandate)
assert_equal(response.before, fixture['body']['meta']['cursors']['before'])
assert_equal(response.after, fixture['body']['meta']['cursors']['after'])
assert_equal([r.created_at for r in response.records],
[b.get('created_at') for b in body])
assert_equal([r.id for r in response.records],
[b.get('id') for b in body])
assert_equal([r.metadata for r in response.records],
[b.get('metadata') for b in body])
assert_equal([r.next_possible_charge_date for r in response.records],
[b.get('next_possible_charge_date') for b in body])
assert_equal([r.reference for r in response.records],
[b.get('reference') for b in body])
assert_equal([r.scheme for r in response.records],
[b.get('scheme') for b in body])
assert_equal([r.status for r in response.records],
[b.get('status') for b in body])
示例9: test_exif_property
def test_exif_property(self):
assert_is_instance(self.p.exif, exif)
def _set():
self.p.exif = None
assert_raises(AttributeError, _set)
示例10: test_resource_definition_via_dict
def test_resource_definition_via_dict():
"""Test programmatic resource definition (as opposed to reading a config file)."""
cfg = gc3libs.config.Configuration()
# define resource
name = 'test'
cfg.resources[name].update(
name=name,
type='shellcmd',
auth='none',
transport='local',
max_cores_per_job=1,
max_memory_per_core=1*GB,
max_walltime=8*hours,
max_cores=2,
architecture=Run.Arch.X86_64,
)
# make it
resources = cfg.make_resources(ignore_errors=False)
# check result
resource = resources[name]
assert_equal(resource.name, name)
assert_is_instance(resource,
gc3libs.backends.shellcmd.ShellcmdLrms)
assert_is_instance(resource.transport,
gc3libs.backends.transport.LocalTransport)
assert_equal(resource.max_cores_per_job, 1)
assert_equal(resource.max_memory_per_core, 1*GB)
assert_equal(resource.max_walltime, 8*hours)
assert_equal(resource.max_cores, 2)
assert_equal(resource.architecture, Run.Arch.X86_64)
示例11: test_subscriptions_create
def test_subscriptions_create():
fixture = helpers.load_fixture('subscriptions')['create']
helpers.stub_response(fixture)
response = helpers.client.subscriptions.create(*fixture['url_params'])
body = fixture['body']['subscriptions']
assert_is_instance(response, resources.Subscription)
assert_equal(response.amount, body.get('amount'))
assert_equal(response.count, body.get('count'))
assert_equal(response.created_at, body.get('created_at'))
assert_equal(response.currency, body.get('currency'))
assert_equal(response.day_of_month, body.get('day_of_month'))
assert_equal(response.end_date, body.get('end_date'))
assert_equal(response.id, body.get('id'))
assert_equal(response.interval, body.get('interval'))
assert_equal(response.interval_unit, body.get('interval_unit'))
assert_equal(response.metadata, body.get('metadata'))
assert_equal(response.month, body.get('month'))
assert_equal(response.name, body.get('name'))
assert_equal(response.payment_reference, body.get('payment_reference'))
assert_equal(response.start_date, body.get('start_date'))
assert_equal(response.status, body.get('status'))
assert_equal(response.upcoming_payments, body.get('upcoming_payments'))
assert_equal(response.links.mandate,
body.get('links')['mandate'])
示例12: test_additional_backend
def test_additional_backend():
"""Test instanciating a non-std backend."""
tmpfile = _setup_config_file("""
[resource/test]
type = noop
auth = none
transport = local
max_cores_per_job = 1
max_memory_per_core = 1
max_walltime = 8
max_cores = 2
architecture = x86_64
""")
try:
cfg = gc3libs.config.Configuration(tmpfile)
cfg.TYPE_CONSTRUCTOR_MAP['noop'] = ('gc3libs.backends.noop', 'NoOpLrms')
resources = cfg.make_resources(ignore_errors=False)
# resources are enabled by default
assert 'test' in resources
from gc3libs.backends.noop import NoOpLrms
assert_is_instance(resources['test'], NoOpLrms)
# test types
finally:
# since TYPE_CONSTRUCTOR_MAP is a class-level variable, we
# need to clean up otherwise other tests will see the No-Op
# backend
del cfg.TYPE_CONSTRUCTOR_MAP['noop']
os.remove(tmpfile)
示例13: test_get_item
def test_get_item(td, raw):
nt.assert_is_instance(td, JSONMapping)
nt.assert_equal(td['a'], 1)
nt.assert_equal(td['b'], JSONSequence(raw['b']))
nt.assert_equal(td['b'][0], 1)
nt.assert_equal(td['c'], JSONMapping(raw['c']))
nt.assert_equal(td['c']['bb'][-1], 3)
示例14: test_csr_signing
def test_csr_signing(self):
pkey = ca.private_key()
req = ca.csr(pkey, CN="App", O="Ezbake", OU="Ezbake Apps", C="US")
cert = self.get_client(5049).csr(self.get_token(), ca.pem_csr(req))
cert = crypto.load_certificate(crypto.FILETYPE_PEM, cert)
nt.assert_is_instance(cert, crypto.X509)
nt.assert_equal(req.get_subject(), cert.get_subject())
示例15: test_families
def test_families():
families = table.families()
for name, fdesc in families.iteritems():
assert_is_instance(name, basestring)
assert_is_instance(fdesc, dict)
assert_in('name', fdesc)
assert_in('max_versions', fdesc)