本文整理汇总了Python中nose.tools.eq_函数的典型用法代码示例。如果您正苦于以下问题:Python eq_函数的具体用法?Python eq_怎么用?Python eq_使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了eq_函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_file_owner
def test_file_owner(self):
new_owner = 'newowner'
self.client.write('foo', 'hello, world!')
self.client.set_owner('foo', 'oldowner')
self.client.set_owner('foo', new_owner)
status = self.client.status('foo')
eq_(status['owner'], new_owner)
示例2: test_with_oddly_formatted_composer_file
def test_with_oddly_formatted_composer_file(self):
exts = self.extension_module.ComposerConfiguration({
'BUILD_DIR': ''
}).read_exts_from_path(
'tests/data/composer/composer-format.json')
eq_(1, len(exts))
eq_('mysqli', exts[0])
示例3: test_valid_disabled_snippet_authenticated
def test_valid_disabled_snippet_authenticated(self):
"""Test disabled snippet returns 200 to authenticated users."""
snippet = SnippetFactory.create(disabled=True)
User.objects.create_superuser('admin', '[email protected]', 'asdf')
self.client.login(username='admin', password='asdf')
response = self.client.get(reverse('base.show', kwargs={'snippet_id': snippet.id}))
eq_(response.status_code, 200)
示例4: test_sample_info_genotype
def test_sample_info_genotype():
variants = load_vcf(data_path("multiallelic.vcf"))
assert len(variants) == 2, "Expected 2 variants but got %s" % variants
eq_(variants.metadata[variants[0]]['sample_info']['metastasis']['GT'],
'0/1')
eq_(variants.metadata[variants[1]]['sample_info']['metastasis']['GT'],
'0/1')
示例5: __test
def __test(hop_length, fmin, n_bins, bins_per_octave,
tuning, resolution, norm, sparsity):
C2 = librosa.hybrid_cqt(y, sr=sr,
hop_length=hop_length,
fmin=fmin, n_bins=n_bins,
bins_per_octave=bins_per_octave,
tuning=tuning, resolution=resolution,
norm=norm,
sparsity=sparsity)
C1 = librosa.cqt(y, sr=sr,
hop_length=hop_length,
fmin=fmin, n_bins=n_bins,
bins_per_octave=bins_per_octave,
tuning=tuning, resolution=resolution,
norm=norm,
sparsity=sparsity)
eq_(C1.shape, C2.shape)
# Check for numerical comparability
idx1 = (C1 > 1e-4 * C1.max())
idx2 = (C2 > 1e-4 * C2.max())
perc = 0.99
thresh = 1e-3
idx = idx1 | idx2
assert np.percentile(np.abs(C1[idx] - C2[idx]),
perc) < thresh * max(C1.max(), C2.max())
示例6: test_channel_edit_child
def test_channel_edit_child(self):
channel = Channel.objects.get(slug='testing')
response = self.client.get(
reverse('manage:channel_edit', args=(channel.pk,)),
)
eq_(response.status_code, 200)
choices = (
response.content
.split('name="parent"')[1]
.split('</select>')[0]
)
ok_('Main' in choices)
# you should not be able to self-reference
ok_('Testing' not in choices)
main = Channel.objects.get(slug='main')
response = self.client.post(
reverse('manage:channel_edit', args=(channel.pk,)),
{
'name': 'Different',
'slug': 'different',
'description': '<p>Other things</p>',
'parent': main.pk,
'feed_size': 10,
}
)
eq_(response.status_code, 302)
channel = Channel.objects.get(slug='different')
eq_(channel.parent, main)
# now expect two links to "Main" on the channels page
response = self.client.get(reverse('manage:channels'))
eq_(response.status_code, 200)
view_url = reverse('main:home_channels', args=(main.slug,))
eq_(response.content.count(view_url), 2)
示例7: test_file_size
def test_file_size(self):
self.viewer.extract()
self.viewer.get_files()
self.viewer.select('install.js')
res = self.viewer.read_file()
eq_(res, '')
assert self.viewer.selected['msg'].startswith('File size is')
示例8: test_solid_paletted_image
def test_solid_paletted_image(self):
img = Image.new('P', (100, 100), color=20)
palette = []
for i in range(256):
palette.extend((i, i//2, i%3))
img.putpalette(palette)
eq_(is_single_color_image(img), (20, 10, 2))
示例9: test_from_paletted
def test_from_paletted(self):
img = self._make_test_image().quantize(256)
img = make_transparent(img, (130, 150, 120), tolerance=5)
assert img.mode == 'RGBA'
assert img.size == (50, 50)
colors = img.getcolors()
eq_(colors, [(1600, (130, 140, 120, 255)), (900, (130, 150, 120, 0))])
示例10: test_seek_iter
def test_seek_iter(self):
self.rbuf_wrapper.seek(0)
data = list(self.rbuf_wrapper)
eq_(data, ['Hello World!'])
self.rbuf_wrapper.seek(0)
data = list(self.rbuf_wrapper)
eq_(data, ['Hello World!'])
示例11: test_solid_merge
def test_solid_merge(self):
img1 = ImageSource(Image.new('RGB', (10, 10), (255, 0, 255)))
img2 = ImageSource(Image.new('RGB', (10, 10), (0, 255, 255)))
result = merge_images([img1, img2], ImageOptions(transparent=False))
img = result.as_image()
eq_(img.getpixel((0, 0)), (0, 255, 255))
示例12: test_dir_with_status
def test_dir_with_status(self):
self.client.write('foo/bar', 'hello, world!')
statuses = self.client.list('foo', status=True)
eq_(len(statuses), 1)
status = self.client.status('foo/bar')
status['pathSuffix'] = 'bar'
eq_(statuses[0], ('bar', status))
示例13: test_file_for_group
def test_file_for_group(self):
new_group = 'newgroup'
self.client.write('foo', 'hello, world!')
self.client.set_owner('foo', group='oldgroup')
self.client.set_owner('foo', group=new_group)
status = self.client.status('foo')
eq_(status['group'], new_group)
示例14: test_directory_for_group
def test_directory_for_group(self):
new_group = 'newgroup'
self.client._mkdirs('foo')
self.client.set_owner('foo', group='oldgroup')
self.client.set_owner('foo', group=new_group)
status = self.client.status('foo')
eq_(status['group'], new_group)
示例15: test_current_versions
def test_current_versions(self, rget):
model = models.CurrentVersions
api = model()
def mocked_get(**options):
assert '/products/' in options['url']
return Response("""
{"hits": {
"SeaMonkey": [{
"product": "SeaMonkey",
"throttle": "100.00",
"end_date": "2012-05-10 00:00:00",
"start_date": "2012-03-08 00:00:00",
"featured": true,
"version": "2.1.3pre",
"release": "Beta",
"id": 922}]
},
"products": ["SeaMonkey"]
}
""")
rget.side_effect = mocked_get
info = api.get()
ok_(isinstance(info, list))
ok_(isinstance(info[0], dict))
eq_(info[0]['product'], 'SeaMonkey')