本文整理汇总了Python中nose.tools.assert_is_not函数的典型用法代码示例。如果您正苦于以下问题:Python assert_is_not函数的具体用法?Python assert_is_not怎么用?Python assert_is_not使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了assert_is_not函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: runTest
def runTest(self):
log.debug('sys.stdout is the initial value: {}'.format(
sys.stdout is _cached_stdout))
assert_is_not(sys.stdout, _cached_stdout) # sys.stdout should be replaced
log.debug('sleeping {} seconds'.format(wait))
time.sleep(wait)
示例2: test_pickle_func
def test_pickle_func():
def f(x):
return x + 23
assert_equal(f(1), 24)
f2 = unpickle(pickle(f))
assert_is_not(f, f2)
assert_equal(f(2), 25)
示例3: test_copy_msg
def test_copy_msg(self):
x = NetParameter()
assert_is_not_none(x)
y = pu.copy_msg(x, NetParameter)
assert_is_not(x, y)
assert_is_not_none(y)
示例4: test_getslice_lazy
def test_getslice_lazy(self):
seq = self.get_sequence([1, 2, 3])
sliced = seq[:2]
tools.assert_is_not(sliced, seq)
tools.assert_items_equal(sliced, [1, 2])
tools.assert_true(seq.iterable)
tools.eq_(list(seq._results.__iter__()), [1, 2])
示例5: test_no_data_leak
def test_no_data_leak():
cols_before = diamonds.columns.copy()
import numpy as np
p = ggplot(aes(x="np.log(price)"), data=diamonds)
cols_after = diamonds.columns.copy()
assert_same_elements(cols_before, cols_after)
assert_is_not(diamonds, p.data)
示例6: test_remap
def test_remap():
src = np.array([1, 2, 3, 4])
mapping = np.array([-1, 10, 20, 30, 40])
rtn = remap(src, mapping)
assert_array_equal(rtn, [10, 20, 30, 40])
assert_is_not(rtn, src)
示例7: test_enqueue_measure1
def test_enqueue_measure1(self):
# Test enqueueing a measure passing the tests using no instruments.
core = self.workbench.get_plugin(u'enaml.workbench.core')
cmd = u'enaml.workbench.ui.select_workspace'
core.invoke_command(cmd, {'workspace': u'hqc_meas.measure.workspace'},
self)
plugin = self.workbench.get_plugin(u'hqc_meas.measure')
measure = Measure(plugin=plugin, name='Test')
measure.root_task = RootTask(default_path=self.test_dir)
plugin.edited_measure = measure
res = plugin.workspace.enqueue_measure(plugin.edited_measure)
assert_true(res)
assert_false(measure.root_task.run_time)
assert_true(plugin.enqueued_measures)
en_meas = plugin.enqueued_measures[0]
assert_is_not(en_meas, measure)
assert_equal(en_meas.status, 'READY')
assert_equal(en_meas.infos,
'The measure is ready to be performed by an engine.')
assert_in('build_deps', en_meas.store)
assert_not_in('profiles', en_meas.store)
示例8: test_enqueue_measure4
def test_enqueue_measure4(self):
# Test enqueueing a measure passing the tests using instruments.
core = self.workbench.get_plugin(u'enaml.workbench.core')
cmd = u'enaml.workbench.ui.select_workspace'
core.invoke_command(cmd, {'workspace': u'hqc_meas.measure.workspace'},
self)
plugin = self.workbench.get_plugin(u'hqc_meas.measure')
false_instr_user = FalseInstrTask(selected_profile=' dummy ',
selected_driver='PanelTestDummy')
measure = Measure(plugin=plugin, name='Test')
measure.root_task = RootTask(default_path=self.test_dir)
measure.root_task.children_task = [false_instr_user]
plugin.edited_measure = measure
res = plugin.workspace.enqueue_measure(plugin.edited_measure)
assert_true(res)
assert_false(measure.root_task.run_time)
assert_true(plugin.enqueued_measures)
en_meas = plugin.enqueued_measures[0]
assert_is_not(en_meas, measure)
assert_equal(en_meas.status, 'READY')
assert_equal(en_meas.infos,
'The measure is ready to be performed by an engine.')
assert_in('build_deps', en_meas.store)
assert_equal([' dummy '], en_meas.store['profiles'])
assert_in('drivers', en_meas.root_task.run_time)
instr_plugin = self.workbench.get_plugin('hqc_meas.instr_manager')
assert_in(' dummy ', instr_plugin.available_profiles)
示例9: test_driver_reload
def test_driver_reload(self):
# Test reloading a driver.
self.workbench.register(InstrManagerManifest())
self.workbench.register(InstrUser1())
core = self.workbench.get_plugin(u'enaml.workbench.core')
com = u'hqc_meas.instr_manager.driver_types_request'
d_types, _ = core.invoke_command(com, {'driver_types': ['Dummy']},
self)
com = u'hqc_meas.instr_manager.drivers_request'
drivers, _ = core.invoke_command(com, {'drivers': ['PanelTestDummy']},
self)
com = u'hqc_meas.instr_manager.reload_driver'
re_driver = core.invoke_command(com, {'driver': 'PanelTestDummy'},
self)
assert_is_not(re_driver, drivers['PanelTestDummy'])
assert_equal(re_driver.__name__, 'PanelTestDummy')
com = u'hqc_meas.instr_manager.driver_types_request'
re_d_types, _ = core.invoke_command(com, {'driver_types': ['Dummy']},
self)
assert_is_not(re_d_types['Dummy'], d_types['Dummy'])
assert_equal(re_d_types['Dummy'].__name__, 'DummyInstrument')
示例10: test_execute
def test_execute(self):
cm = ComputationManager()
df = pd.DataFrame(np.random.randn(30, 3), columns=['a', 'bob', 'c'])
source = "df.rolling(5).sum()"
entry = cm_get(cm, source, locals(), globals())
# execute first time
val = cm.execute(entry)
correct = df.rolling(5).sum()
nt.assert_is_not(val, correct)
tm.assert_frame_equal(val, correct)
# execute again should return existing value
val2 = cm.execute(entry)
nt.assert_is(val, val2)
entry2 = cm_get(cm, source, locals(), globals())
nt.assert_is(entry, entry2)
nt.assert_true(entry2.executed)
# override keyword
val3 = cm.execute(entry, override=True)
nt.assert_is_not(val, val3)
tm.assert_frame_equal(val, val3)
cm = ComputationManager()
示例11: test_restricted_induced_subgraph_chains
def test_restricted_induced_subgraph_chains(self):
""" Test subgraph chains that both restrict and show nodes/edges.
A restricted_view subgraph should allow induced subgraphs using
G.subgraph that automagically without a chain (meaning the result
is a subgraph view of the original graph not a subgraph-of-subgraph.
"""
hide_nodes = [3, 4, 5]
hide_edges = [(6, 7)]
RG = nx.restricted_view(self.G, hide_nodes, hide_edges)
nodes = [4, 5, 6, 7, 8]
SG = nx.induced_subgraph(RG, nodes)
SSG = RG.subgraph(nodes)
assert_is(SSG.root_graph, SSG._graph)
assert_is_not(SG.root_graph, SG._graph)
assert_edges_equal(SG.edges, SSG.edges)
# should be same as morphing the graph
CG = self.G.copy()
CG.remove_nodes_from(hide_nodes)
CG.remove_edges_from(hide_edges)
assert_edges_equal(CG.edges(nodes), SSG.edges)
CG.remove_nodes_from([0, 1, 2, 3])
assert_edges_equal(CG.edges, SSG.edges)
# switch order: subgraph first, then restricted view
SSSG = self.G.subgraph(nodes)
RSG = nx.restricted_view(SSSG, hide_nodes, hide_edges)
assert_is_not(RSG.root_graph, RSG._graph)
assert_edges_equal(RSG.edges, CG.edges)
示例12: test_getitem
def test_getitem(self):
assert_is_not(self.adjview[1], self.s[1])
assert_is(self.adjview[0][7], self.adjview[0][3])
assert_equal(self.adjview[2]['key']['color'], 1)
assert_equal(self.adjview[2][1]['span'], 2)
assert_raises(KeyError, self.adjview.__getitem__, 4)
assert_raises(KeyError, self.adjview[1].__getitem__, 'key')
示例13: test_retrieval
def test_retrieval(self):
user = self.User.items.create(uid=123)
token = self.Token(uid=123, token='abc')
tools.assert_not_in('_user_cache', vars(token))
tools.eq_(dict(token), {'uid': 123, 'token': 'abc'})
tools.eq_(token.user, user)
tools.assert_is_not(token.user, user)
tools.assert_in('_user_cache', vars(token))
示例14: test_flip_copy
def test_flip_copy():
x = np.arange(12.0)
y = sgrid.reshape_array((3, 4), x, flip_vertically=True, copy=True)
assert_equal(y.shape, (3, 4))
assert_array_equal(y, np.array([[8.0, 9.0, 10.0, 11.0], [4.0, 5.0, 6.0, 7.0], [0.0, 1.0, 2.0, 3.0]]))
assert_true(y.flags["C_CONTIGUOUS"])
assert_is_not(y.base, x)
示例15: test_set_preserves_identity
def test_set_preserves_identity(self):
first_get = self.get()
assert_is_not(self.new_value, first_get)
self.set(self.new_value)
second_get = self.get()
assert_is(self.new_value, second_get)
assert_is_not(first_get, second_get)