예제 #1
0
 def test_set_exists_wrong_type(self):
     gb1 = GroupBuilder('gb1')
     gb2 = GroupBuilder('gb2')
     db = DatasetBuilder('gb2')
     gb1.set_group(gb2)
     msg = "'gb2' already exists in gb1.groups, cannot set in datasets."
     with self.assertRaisesWith(ValueError, msg):
         gb1.set_dataset(db)
예제 #2
0
 def test_set_dataset(self):
     gb = GroupBuilder('gb')
     db = DatasetBuilder('db', list(range(10)))
     gb.set_dataset(db)
     self.assertIs(db.parent, gb)
     self.assertIn('db', gb.obj_type)
     self.assertIn('db', gb.datasets)
     self.assertIs(gb['db'], db)