def test_mutually_exclusive_subgroups(self): gb1 = GroupBuilder('gb1', {'subgroup1': GroupBuilder('subgroup1')}) gb2 = GroupBuilder('gb2', {'subgroup2': GroupBuilder('subgroup2')}) gb1.deep_update(gb2) self.assertIn('subgroup2', gb1) gb1sg = gb1['subgroup2'] gb2sg = gb2['subgroup2'] self.assertIs(gb1sg, gb2sg)
def test_intersecting_links(self): gb1 = GroupBuilder( 'gb1', links={'link2': LinkBuilder(GroupBuilder('target1'), 'link2')}) gb2 = GroupBuilder( 'gb2', links={'link2': LinkBuilder(GroupBuilder('target2'), 'link2')}) gb1.deep_update(gb2) self.assertIn('link2', gb2) self.assertEqual(gb1['link2'], gb2['link2'])
def test_intersecting_datasets(self): gb1 = GroupBuilder( 'gb1', datasets={'dataset2': DatasetBuilder('dataset2', [1, 2, 3])}) gb2 = GroupBuilder( 'gb2', datasets={'dataset2': DatasetBuilder('dataset2', [4, 5, 6])}) gb1.deep_update(gb2) self.assertIn('dataset2', gb1) self.assertListEqual(gb1['dataset2'].data, gb2['dataset2'].data)
def test_mutually_exclusive_links(self): gb1 = GroupBuilder( 'gb1', links={'link1': LinkBuilder(GroupBuilder('target1'), 'link1')}) gb2 = GroupBuilder( 'gb2', links={'link2': LinkBuilder(GroupBuilder('target2'), 'link2')}) gb1.deep_update(gb2) self.assertIn('link2', gb2) self.assertEqual(gb1['link2'], gb2['link2'])
def test_mutually_exclusive_datasets(self): gb1 = GroupBuilder( 'gb1', datasets={'dataset1': DatasetBuilder('dataset1', [1, 2, 3])}) gb2 = GroupBuilder( 'gb2', datasets={'dataset2': DatasetBuilder('dataset2', [4, 5, 6])}) gb1.deep_update(gb2) self.assertIn('dataset2', gb1) # self.assertIs(gb1['dataset2'], gb2['dataset2']) self.assertListEqual(gb1['dataset2'].data, gb2['dataset2'].data)
def test_intersecting_subgroups(self): subgroup2 = GroupBuilder('subgroup2') gb1 = GroupBuilder('gb1', { 'subgroup1': GroupBuilder('subgroup1'), 'subgroup2': subgroup2 }) gb2 = GroupBuilder( 'gb2', { 'subgroup2': GroupBuilder('subgroup2'), 'subgroup3': GroupBuilder('subgroup3') }) gb1.deep_update(gb2) self.assertIn('subgroup3', gb1) self.assertIs(gb1['subgroup3'], gb2['subgroup3']) self.assertIs(gb1['subgroup2'], subgroup2)
def test_intersecting_attributes(self): gb1 = GroupBuilder('gb1', attributes={'attr2': 'my_attribute1'}) gb2 = GroupBuilder('gb2', attributes={'attr2': 'my_attribute2'}) gb1.deep_update(gb2) self.assertIn('attr2', gb2) self.assertEqual(gb2['attr2'], 'my_attribute2')
def test_mutually_exclusive_attributes(self): gb1 = GroupBuilder('gb1', attributes={'attr1': 'my_attribute1'}) gb2 = GroupBuilder('gb2', attributes={'attr2': 'my_attribute2'}) gb1.deep_update(gb2) self.assertIn('attr2', gb2) self.assertEqual(gb2['attr2'], 'my_attribute2')