本文整理汇总了Python中nose.tools.assert_tuple_equal函数的典型用法代码示例。如果您正苦于以下问题:Python assert_tuple_equal函数的具体用法?Python assert_tuple_equal怎么用?Python assert_tuple_equal使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了assert_tuple_equal函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: test_round_off_error
def test_round_off_error():
(x, y) = sgrid.node_coords((135, 127),
(5.4563957090392, 5.4563957090392),
(0., 0.))
assert_tuple_equal(x.shape, (135 * 127, ))
assert_tuple_equal(y.shape, (135 * 127, ))
开发者ID:jennyknuth,项目名称:landlab,代码行数:7,代码来源:test_structured_grid.py
示例2: test_get_device
def test_get_device():
active_devices = {
u'addr1': (1406362740.570188, u'192.168.1.2', u'tom'),
u'addr2': (1006362740.0, u'192.168.1.82', u'william'),
}
n.assert_tuple_equal(u.get_device(active_devices, u'192.168.1.82'), ('addr2', u'william'))
n.assert_tuple_equal(u.get_device(active_devices, u'192.168.4.10'), (None, None))
开发者ID:tlevine,项目名称:at,代码行数:7,代码来源:test_updater.py
示例3: test_wqstd
def test_wqstd(self):
nt.assert_true(isinstance(self.db.wqstd, pandas.DataFrame))
nt.assert_tuple_equal(self.db.wqstd.shape, (48, 4))
nt.assert_list_equal(
['parameter', 'units', 'lower_limit', 'upper_limit'],
self.db.wqstd.columns.tolist()
)
开发者ID:Geosyntec,项目名称:pycvc,代码行数:7,代码来源:dataaccess_tests.py
示例4: _test
def _test(*args, **kwargs):
expect = ('foo', 'bar')
assert_tuple_equal(args, expect)
expect = dict([
('baz', 'qux'),
('ledger_hash', 'foo_ledger'),
])
assert_dict_equal(kwargs, expect)
开发者ID:thelinuxkid,项目名称:ripple,代码行数:8,代码来源:test_jsonrpc.py
示例5: test_getWQData
def test_getWQData(self):
ed1 = self.db.getWQData('ED-1')
nt.assert_true(isinstance(ed1, pandas.DataFrame))
nt.assert_tuple_equal(ed1.shape, (12, 11))
lv1 = self.db.getWQData('LV-1')
nt.assert_true(isinstance(lv1, pandas.DataFrame))
nt.assert_tuple_equal(lv1.shape, (0, 11))
开发者ID:Geosyntec,项目名称:pycvc,代码行数:8,代码来源:dataaccess_tests.py
示例6: test_nodes
def test_nodes():
"""Test getting nodes at links from a voronoi."""
converter = VoronoiConverter(Voronoi(POINTS))
nodes = converter.get_nodes()
assert_tuple_equal(nodes.shape, (10, 2))
assert_is_instance(nodes[0, 0], float)
开发者ID:Carralex,项目名称:landlab,代码行数:8,代码来源:test_graph.py
示例7: test_fake_bathy
def test_fake_bathy(self):
elev = misc.interpolate_bathymetry(None, self.grid.x_rho, self.grid.y_rho)
nptest.assert_array_equal(
elev,
np.ma.MaskedArray(data=np.zeros(self.grid.x_rho.shape),
mask=self.grid.x_rho.mask)
)
nt.assert_tuple_equal(elev.shape, self.grid.x_rho.shape)
开发者ID:lucashtnguyen,项目名称:pygridtools,代码行数:8,代码来源:test_misc.py
示例8: test_read_config_params
def test_read_config_params():
tmp = tempfile.NamedTemporaryFile()
copyfile(CONFIG, tmp.name)
observed = p.read_config_params(tmp.name)
expected = ('the-ca-bundle-file.crt',
'https://delaware.dada.pink', 'tlevine',
'065db5d3-924c-4129-9c93-2360538a4ce5')
n.assert_tuple_equal(observed, expected)
开发者ID:tlevine,项目名称:delaware,代码行数:8,代码来源:test_params.py
示例9: check_convert_dates
def check_convert_dates(raw, expectation):
result = convert_dates(raw, lambda x: convert_date(x, year = 2014))
if expectation == None:
n.assert_is_none(result)
else:
n.assert_is_not_none(result)
observed = tuple((x.month, x.day) for x in result)
n.assert_tuple_equal(observed, expectation)
开发者ID:tlevine,项目名称:cloud-beds,代码行数:8,代码来源:test_convert_date.py
示例10: test_pack
def test_pack():
for x in (32, -3.7e-2, np.float64(3e31), -np.inf, np.int8(-3), np.uint8(-1),
np.int16(-33), np.uint16(-33), np.int32(-3), np.uint32(-1), np.int64(373), np.uint64(-3)):
assert_equal(x, unpack(pack(x)), "Scalars don't match!")
x = np.nan
assert_true(np.isnan(unpack(pack(x))), "nan scalar did not match!")
x = np.random.randn(8, 10)
assert_array_equal(x, unpack(pack(x)), "Arrays do not match!")
x = np.random.randn(10)
assert_array_equal(x, unpack(pack(x)), "Arrays do not match!")
x = np.float32(np.random.randn(3, 4, 5))
assert_array_equal(x, unpack(pack(x)), "Arrays do not match!")
x = np.int16(np.random.randn(1, 2, 3))
assert_array_equal(x, unpack(pack(x)), "Arrays do not match!")
x = None
assert_true(x is None, "None did not match")
x = [None]
assert_list_equal(x, unpack(pack(x)))
x = {'name': 'Anonymous', 'age': 15, 99: datetime.now(), 'range': [110, 190], (11,12): None}
assert_dict_equal(x, unpack(pack(x)), "Dict do not match!")
x = uuid.uuid4()
assert_equal(x, unpack(pack(x)), 'UUID did not match')
x = Decimal("-112122121.000003000")
assert_equal(x, unpack(pack(x)), "Decimal did not pack/unpack correctly")
x = [1, datetime.now(), {1: "one", "two": 2}, (1, 2)]
assert_list_equal(x, unpack(pack(x)), "List did not pack/unpack correctly")
x = (1, datetime.now(), {1: "one", "two": 2}, (uuid.uuid4(), 2))
assert_tuple_equal(x, unpack(pack(x)), "Tuple did not pack/unpack correctly")
x = (1, {datetime.now().date(): "today", "now": datetime.now().date()}, {"yes!": [1, 2, np.array((3, 4))]})
y = unpack(pack(x))
assert_dict_equal(x[1], y[1])
assert_array_equal(x[2]['yes!'][2], y[2]['yes!'][2])
x = {'elephant'}
assert_set_equal(x, unpack(pack(x)), "Set did not pack/unpack correctly")
x = tuple(range(10))
assert_tuple_equal(x, unpack(pack(range(10))), "Iterator did not pack/unpack correctly")
x = Decimal('1.24')
assert_true(x == unpack(pack(x)), "Decimal object did not pack/unpack correctly")
x = datetime.now()
assert_true(x == unpack(pack(x)), "Datetime object did not pack/unpack correctly")
开发者ID:dimitri-yatsenko,项目名称:datajoint-python,代码行数:58,代码来源:test_blob.py
示例11: test_grid_var_names
def test_grid_var_names():
model = BmiHeat()
model.initialize()
names = model.get_input_var_names()
assert_tuple_equal(names, ('plate_surface__temperature',))
names = model.get_output_var_names()
assert_tuple_equal(names, ('plate_surface__temperature',))
开发者ID:katmratliff,项目名称:bmi-python,代码行数:9,代码来源:test_grid_info.py
示例12: test_guess_dialect
def test_guess_dialect():
empty = StringIO('')
n.assert_equal(dsv.guess_dialect(empty), 'excel')
interesting = StringIO('a;b;c\r\n3;";";8\r\n')
dialect = dsv.guess_dialect(interesting)
observed = tuple(getattr(dialect, attr) for attr in ('delimiter', 'doublequote', 'escapechar', 'lineterminator', 'quotechar', 'quoting', 'skipinitialspace'))
expected = (';', False, None, '\r\n', '"', 0, False)
n.assert_tuple_equal(observed, expected)
开发者ID:tlevine,项目名称:commasearch,代码行数:9,代码来源:test_dsv.py
示例13: test_patches_at_link
def test_patches_at_link():
"""Test getting link patches."""
converter = VoronoiConverter(Voronoi(POINTS))
patches_at_link = converter.get_patches_at_link()
assert_tuple_equal(patches_at_link.shape, (11, 2))
for patches in patches_at_link:
assert_true(patches[0] != -1 or patches[1] != -1)
开发者ID:Carralex,项目名称:landlab,代码行数:9,代码来源:test_graph.py
示例14: test_links_at_patch
def test_links_at_patch():
"""Test getting links that bound patches from a voronoi."""
converter = VoronoiConverter(Voronoi(POINTS))
links_at_patch = converter.get_links_at_patch()
assert_tuple_equal(links_at_patch.shape, (2, 6))
assert_true(np.all(links_at_patch >= 0))
assert_true(np.all(links_at_patch < 11))
开发者ID:Carralex,项目名称:landlab,代码行数:9,代码来源:test_graph.py
示例15: test_repr_contains_db_info_tcp
def test_repr_contains_db_info_tcp(self):
pool = ConnectionPool(host='localhost', port=8888)
assert_tuple_equal(
re.match('(.*)<(.*)<(.*)>>', repr(pool)).groups(),
(
'ConnectionPool',
'Connection',
'host=localhost,port=8888'
)
)
开发者ID:Zuckonit,项目名称:ssdb-py,代码行数:10,代码来源:test_connection_pool.py
示例16: test_ridges_at_region
def test_ridges_at_region():
"""Test getting ridges that bound regions."""
v = Voronoi(POINTS)
converter = VoronoiConverter(v)
ridges_at_region = converter.get_ridges_at_region()
assert_tuple_equal(ridges_at_region.shape, (len(v.regions), 6))
assert_is_instance(ridges_at_region[0, 0], np.int_)
assert_array_equal(ridges_at_region[0], [-1] * 6)
开发者ID:Carralex,项目名称:landlab,代码行数:10,代码来源:test_graph.py
示例17: test_my_stack
def test_my_stack():
"""Testing my_stack function"""
mats = []
for n in xrange(7):
mats.append(np.random.rand(31, 31))
stacked = my_mfd.my_stack(mats)
assert_is_instance(stacked, np.ndarray)
assert_tuple_equal(stacked.shape, (7, 31, 31))
for n in xrange(7):
assert_array_equal(stacked[n], mats[n])
开发者ID:rphlypo,项目名称:parietalretreat,代码行数:10,代码来源:test_manifold.py
示例18: test_1_component_dict_interface
def test_1_component_dict_interface():
palette = Palette(sample=Sample1)
assert_dict_equal(dict(sample=Sample1), palette)
assert_equal(len(palette), 1)
assert_equal(palette.keys(), ['sample'])
assert_equal(palette.values(), [Sample1])
items = palette.items()
assert_tuple_equal(('sample', Sample1), items[0])
开发者ID:Kirubaharan,项目名称:landlab,代码行数:10,代码来源:test_collections.py
示例19: test_corner_at_patch
def test_corner_at_patch():
"""Test getting corners for each patch."""
v = Voronoi(POINTS)
converter = VoronoiConverter(v)
corner_at_patch = converter.get_corner_at_patch()
assert_tuple_equal(corner_at_patch.shape, (2, ))
assert_true(np.all(corner_at_patch >= 0))
assert_true(np.all(corner_at_patch < len(v.points)))
开发者ID:Carralex,项目名称:landlab,代码行数:10,代码来源:test_graph.py
示例20: test_process
def test_process(self):
raster = utils.polygons_to_raster(self.testfile, "GeoID", **self.kwargs)
nt.assert_true(isinstance(raster, arcpy.Raster))
array = utils.rasters_to_arrays(raster, squeeze=True)
arcpy.management.Delete(raster)
flat_arr = array.flatten()
bins = numpy.bincount(flat_arr[flat_arr > 0])
nptest.assert_array_almost_equal(numpy.unique(array), self.known_values)
nptest.assert_array_almost_equal(bins[bins > 0], self.known_counts)
nt.assert_tuple_equal(array.shape, self.known_shape)
开发者ID:Geosyntec,项目名称:python-tidegates,代码行数:12,代码来源:test_utils.py
注:本文中的nose.tools.assert_tuple_equal函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论