本文整理汇总了Python中entities.Entity.merge方法的典型用法代码示例。如果您正苦于以下问题:Python Entity.merge方法的具体用法?Python Entity.merge怎么用?Python Entity.merge使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类entities.Entity
的用法示例。
在下文中一共展示了Entity.merge方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_merge_rels
# 需要导入模块: from entities import Entity [as 别名]
# 或者: from entities.Entity import merge [as 别名]
def test_merge_rels(self):
entity1 = Entity(serves=['a','b','c'])
entity2 = Entity(serves=['c','d','e'])
entity1.merge(entity2)
serves = ['a', 'b', 'c', 'd', 'e']
assert len(entity1.data['serves']) == 5
for i in serves:
assert i in entity1.data['serves']
示例2: test_merge_existing_pass
# 需要导入模块: from entities import Entity [as 别名]
# 或者: from entities.Entity import merge [as 别名]
def test_merge_existing_pass(self):
entity1 = Entity()
entity1.add_identifier('abc')
entity2 = Entity()
entity2.add_identifier('abc')
entity1.merge(entity2)
assert len(entity1.identifiers()) == 1
assert entity1.identifiers()[0] == 'abc'
示例3: test_merge_tags
# 需要导入模块: from entities import Entity [as 别名]
# 或者: from entities.Entity import merge [as 别名]
def test_merge_tags(self):
entity1 = Entity()
entity1.set_tag('foo','bar')
entity2 = Entity()
entity2.set_tag('cat','dog')
entity1.merge(entity2)
tags = entity1.tags()
assert tags['foo'] == 'bar'
assert tags['cat'] == 'dog'
示例4: test_merge
# 需要导入模块: from entities import Entity [as 别名]
# 或者: from entities.Entity import merge [as 别名]
def test_merge(self):
data = ['abc', 'def']
entity1 = Entity()
entity1.add_identifier('abc')
entity2 = Entity()
entity2.add_identifier('def')
entity1.merge(entity2)
assert len(entity1.identifiers()) == 2
for i in entity1.identifiers():
assert i in data
示例5: test_merge_2
# 需要导入模块: from entities import Entity [as 别名]
# 或者: from entities.Entity import merge [as 别名]
def test_merge_2(self):
data = ['abc', 'def']
entity1 = Entity(
name='abc',
geometry=1
)
entity1.add_identifier('abc')
entity2 = Entity(
name='def',
geometry=2
)
entity2.add_identifier('def')
entity1.merge(entity2)
assert entity1.name() == entity2.name()
assert entity1.geometry() == entity2.geometry()