def test_grouped_copy(T1):
 for masked in (False, True):
  t1 = Table(T1, masked=masked)
  tg = t1.group_by('a')
  tgc = tg.copy()
  assert np.all((tgc.groups.indices == tg.groups.indices))
  assert np.all((tgc.groups.keys == tg.groups.keys))
  tac = tg['a'].copy()
  assert np.all((tac.groups.indices == tg['a'].groups.indices))
  c1 = t1['a'].copy()
  gc1 = c1.group_by(t1['a'])
  gc1c = gc1.copy()
  assert np.all((gc1c.groups.indices == np.array([0, 1, 4, 8])))

def test_grouped_copy ( T1 ) : for masked in ( False , True ) : t1 = Table ( T1 , masked = masked ) tg = t1 . group_by ( 'a' ) tgc = tg . copy ( ) assert np . all ( ( tgc . groups . indices == tg . groups . indices ) ) assert np . all ( ( tgc . groups . keys == tg . groups . keys ) ) tac = tg [ 'a' ] . copy ( ) assert np . all ( ( tac . groups . indices == tg [ 'a' ] . groups . indices ) ) c1 = t1 [ 'a' ] . copy ( ) gc1 = c1 . group_by ( t1 [ 'a' ] ) gc1c = gc1 . copy ( ) assert np . all ( ( gc1c . groups . indices == np . array ( [ 0 , 1 , 4 , 8 ] ) ) )
test that copying a table or column copies the groups properly .