def test_replace_update_column_via_setitem_warnings_always():
 t = table.Table([[1, 2, 3], [4, 5, 6]], names=['a', 'b'])
 with catch_warnings() as w:
  with table.conf.set_temp('replace_warnings', ['always']):
   t['a'] = 0
   assert (len(w) == 0)
   from inspect import currentframe, getframeinfo
   frameinfo = getframeinfo(currentframe())
   t['a'] = [10, 20, 30]
   assert (len(w) == 1)
   assert ("replaced column 'a'" == str(w[0].message))
   assert (w[0].lineno == (frameinfo.lineno + 1))
   assert (w[0].category is table.TableReplaceWarning)
   assert ('test_table' in w[0].filename)

def test_replace_update_column_via_setitem_warnings_always ( ) : t = table . Table ( [ [ 1 , 2 , 3 ] , [ 4 , 5 , 6 ] ] , names = [ 'a' , 'b' ] ) with catch_warnings ( ) as w : with table . conf . set_temp ( 'replace_warnings' , [ 'always' ] ) : t [ 'a' ] = 0 assert ( len ( w ) == 0 ) from inspect import currentframe , getframeinfo frameinfo = getframeinfo ( currentframe ( ) ) t [ 'a' ] = [ 10 , 20 , 30 ] assert ( len ( w ) == 1 ) assert ( "replaced column 'a'" == str ( w [ 0 ] . message ) ) assert ( w [ 0 ] . lineno == ( frameinfo . lineno + 1 ) ) assert ( w [ 0 ] . category is table . TableReplaceWarning ) assert ( 'test_table' in w [ 0 ] . filename )
test warnings related to table replace change in #5556: test always setting that raises warning for any replace .