def test_assignment_and_copy():
 for name in ('quantity', 'arraywrap'):
  m = MIXIN_COLS[name]
  t0 = QTable([m], names=['m'])
  for (i0, i1) in ((1, 2), (slice(0, 2), slice(1, 3)), (np.array([1, 2]), np.array([2, 3]))):
   t = t0.copy()
   t['m'][i0] = m[i1]
   if (name == 'arraywrap'):
    assert np.all((t['m'].data[i0] == m.data[i1]))
    assert np.all((t0['m'].data[i0] == m.data[i0]))
    assert np.all((t0['m'].data[i0] != t['m'].data[i0]))
   else:
    assert np.all((t['m'][i0] == m[i1]))
    assert np.all((t0['m'][i0] == m[i0]))
    assert np.all((t0['m'][i0] != t['m'][i0]))

def test_assignment_and_copy ( ) : for name in ( 'quantity' , 'arraywrap' ) : m = MIXIN_COLS [ name ] t0 = QTable ( [ m ] , names = [ 'm' ] ) for ( i0 , i1 ) in ( ( 1 , 2 ) , ( slice ( 0 , 2 ) , slice ( 1 , 3 ) ) , ( np . array ( [ 1 , 2 ] ) , np . array ( [ 2 , 3 ] ) ) ) : t = t0 . copy ( ) t [ 'm' ] [ i0 ] = m [ i1 ] if ( name == 'arraywrap' ) : assert np . all ( ( t [ 'm' ] . data [ i0 ] == m . data [ i1 ] ) ) assert np . all ( ( t0 [ 'm' ] . data [ i0 ] == m . data [ i0 ] ) ) assert np . all ( ( t0 [ 'm' ] . data [ i0 ] != t [ 'm' ] . data [ i0 ] ) ) else : assert np . all ( ( t [ 'm' ] [ i0 ] == m [ i1 ] ) ) assert np . all ( ( t0 [ 'm' ] [ i0 ] == m [ i0 ] ) ) assert np . all ( ( t0 [ 'm' ] [ i0 ] != t [ 'm' ] [ i0 ] ) )
test that assignment of an int .