<s> """<STR_LIT>""" <EOL> from __future__ import print_function <EOL> from __future__ import absolute_import <EOL> import os <EOL> import re <EOL> import tempfile <EOL> import tables <EOL> from tables . tests import common <EOL> from tables . tests . common import unittest <EOL> from tables . tests . common import PyTablesTestCase as TestCase <EOL> from six . moves import range <EOL> class HardLinkTestCase ( common . TempFileMixin , TestCase ) : <EOL> def setUp ( self ) : <EOL> super ( HardLinkTestCase , self ) . setUp ( ) <EOL> self . _createFile ( ) <EOL> def _createFile ( self ) : <EOL> self . h5file . create_array ( '<STR_LIT:/>' , '<STR_LIT>' , [ <NUM_LIT:1> , <NUM_LIT:2> ] ) <EOL> group1 = self . h5file . create_group ( '<STR_LIT:/>' , '<STR_LIT>' ) <EOL> arr2 = self . h5file . create_array ( group1 , '<STR_LIT>' , [ <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:3> ] ) <EOL> lgroup1 = self . h5file . create_hard_link ( '<STR_LIT:/>' , '<STR_LIT>' , '<STR_LIT>' ) <EOL> self . assertTrue ( lgroup1 is not None ) <EOL> larr1 = self . h5file . create_hard_link ( group1 , '<STR_LIT>' , '<STR_LIT>' ) <EOL> self . assertTrue ( larr1 is not None ) <EOL> larr2 = self . h5file . create_hard_link ( '<STR_LIT:/>' , '<STR_LIT>' , arr2 ) <EOL> self . assertTrue ( larr2 is not None ) <EOL> def test00_create ( self ) : <EOL> """<STR_LIT>""" <EOL> self . _checkEqualityGroup ( self . h5file . root . group1 , <EOL> self . h5file . root . lgroup1 , <EOL> hardlink = True ) <EOL> self . _checkEqualityLeaf ( self . h5file . root . arr1 , <EOL> self . h5file . root . group1 . larr1 , <EOL> hardlink = True ) <EOL> self . _checkEqualityLeaf ( self . h5file . root . lgroup1 . arr2 , <EOL> self . h5file . root . larr2 , <EOL> hardlink = True ) <EOL> def test01_open ( self ) : <EOL> """<STR_LIT>""" <EOL> self . _reopen ( ) <EOL> self . _checkEqualityGroup ( self . h5file . root . group1 , <EOL> self . h5file . root . lgroup1 , <EOL> hardlink = True ) <EOL> self . _checkEqualityLeaf ( self . h5file . root . arr1 , <EOL> self . h5file . root . group1 . larr1 , <EOL> hardlink = True ) <EOL> self . _checkEqualityLeaf ( self . h5file . root . lgroup1 . arr2 , <EOL> self . h5file . root . larr2 , <EOL> hardlink = True ) <EOL> def test02_removeLeaf ( self ) : <EOL> """<STR_LIT>""" <EOL> self . h5file . root . arr1 . remove ( ) <EOL> self . assertTrue ( '<STR_LIT>' not in self . h5file ) <EOL> if common . verbose : <EOL> print ( "<STR_LIT>" , self . h5file . root . group1 . larr1 ) <EOL> self . assertTrue ( '<STR_LIT>' in self . h5file ) <EOL> self . h5file . root . group1 . larr1 . remove ( ) <EOL> self . assertTrue ( '<STR_LIT>' not in self . h5file ) <EOL> def test03_removeGroup ( self ) : <EOL> """<STR_LIT>""" <EOL> if common . verbose : <EOL> print ( "<STR_LIT>" , self . h5file ) <EOL> self . h5file . root . group1 . _f_remove ( force = True ) <EOL> self . assertTrue ( '<STR_LIT>' not in self . h5file ) <EOL> if common . verbose : <EOL> print ( "<STR_LIT>" , self . h5file . root . lgroup1 ) <EOL> print ( "<STR_LIT>" , self . h5file ) <EOL> self . assertTrue ( '<STR_LIT>' in self . h5file ) <EOL> self . h5file . root . lgroup1 . _g_remove ( recursive = True ) <EOL> self . assertTrue ( '<STR_LIT>' not in self . h5file ) <EOL> if common . verbose : <EOL> print ( "<STR_LIT>" , self . h5file ) <EOL> class SoftLinkTestCase ( common . TempFileMixin , TestCase ) : <EOL> def setUp ( self ) : <EOL> super ( SoftLinkTestCase , self ) . setUp ( ) <EOL> self . _createFile ( ) <EOL> def _createFile ( self ) : <EOL> self . h5file . create_array ( '<STR_LIT:/>' , '<STR_LIT>' , [ <NUM_LIT:1> , <NUM_LIT:2> ] ) <EOL> group1 = self . h5file . create_group ( '<STR_LIT:/>' , '<STR_LIT>' ) <EOL> arr2 = self . h5file . create_array ( group1 , '<STR_LIT>' , [ <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:3> ] ) <EOL> lgroup1 = self . h5file . create_soft_link ( '<STR_LIT:/>' , '<STR_LIT>' , '<STR_LIT>' ) <EOL> self . assertTrue ( lgroup1 is not None ) <EOL> larr1 = self . h5file . create_soft_link ( group1 , '<STR_LIT>' , '<STR_LIT>' ) <EOL> self . assertTrue ( larr1 is not None ) <EOL> larr2 = self . h5file . create_soft_link ( '<STR_LIT:/>' , '<STR_LIT>' , arr2 ) <EOL> self . assertTrue ( larr2 is not None ) <EOL> def test00_create ( self ) : <EOL> """<STR_LIT>""" <EOL> self . _checkEqualityGroup ( self . h5file . root . group1 , <EOL> self . h5file . root . lgroup1 ( ) ) <EOL> self . _checkEqualityLeaf ( self . h5file . root . arr1 , <EOL> self . h5file . root . group1 . larr1 ( ) ) <EOL> self . _checkEqualityLeaf ( self . h5file . root . lgroup1 ( ) . arr2 , <EOL> self . h5file . root . larr2 ( ) ) <EOL> def test01_open ( self ) : <EOL> """<STR_LIT>""" <EOL> self . _reopen ( ) <EOL> self . _checkEqualityGroup ( self . h5file . root . group1 , <EOL> self . h5file . root . lgroup1 ( ) ) <EOL> self . _checkEqualityLeaf ( self . h5file . root . arr1 , <EOL> self . h5file . root . group1 . larr1 ( ) ) <EOL> self . _checkEqualityLeaf ( self . h5file . root . lgroup1 ( ) . arr2 , <EOL> self . h5file . root . larr2 ( ) ) <EOL> def test02_remove ( self ) : <EOL> """<STR_LIT>""" <EOL> self . h5file . root . arr1 . remove ( ) <EOL> self . assertTrue ( '<STR_LIT>' not in self . h5file ) <EOL> if common . verbose : <EOL> print ( "<STR_LIT>" , self . h5file . root . group1 . larr1 ) <EOL> self . assertTrue ( '<STR_LIT>' in self . h5file ) <EOL> self . h5file . root . group1 . larr1 . remove ( ) <EOL> self . assertTrue ( '<STR_LIT>' not in self . h5file ) <EOL> def test03_copy ( self ) : <EOL> """<STR_LIT>""" <EOL> root = self . h5file . root <EOL> lgroup1 = root . lgroup1 <EOL> lgroup2 = lgroup1 . copy ( '<STR_LIT:/>' , '<STR_LIT>' ) <EOL> self . assertTrue ( '<STR_LIT>' in self . h5file ) <EOL> self . assertTrue ( '<STR_LIT>' in self . h5file ) <EOL> self . assertTrue ( '<STR_LIT>' in root . _v_children ) <EOL> self . assertTrue ( '<STR_LIT>' in root . _v_links ) <EOL> if common . verbose : <EOL> print ( "<STR_LIT>" , lgroup2 ) <EOL> lgroup1 . remove ( ) <EOL> self . _checkEqualityGroup ( self . h5file . root . group1 , <EOL> self . h5file . root . lgroup2 ( ) ) <EOL> def test03_overwrite ( self ) : <EOL> """<STR_LIT>""" <EOL> root = self . h5file . root <EOL> lgroup1 = root . lgroup1 <EOL> lgroup2 = lgroup1 . copy ( '<STR_LIT:/>' , '<STR_LIT>' ) <EOL> lgroup2 = lgroup1 . copy ( '<STR_LIT:/>' , '<STR_LIT>' , overwrite = True ) <EOL> self . assertTrue ( '<STR_LIT>' in self . h5file ) <EOL> self . assertTrue ( '<STR_LIT>' in self . h5file ) <EOL> self . assertTrue ( '<STR_LIT>' in root . _v_children ) <EOL> self . assertTrue ( '<STR_LIT>' in root . _v_links ) <EOL> if common . verbose : <EOL> print ( "<STR_LIT>" , lgroup2 ) <EOL> lgroup1 . remove ( ) <EOL> self . _checkEqualityGroup ( self . h5file . root . group1 , <EOL> self . h5file . root . lgroup2 ( ) ) <EOL> def test04_move ( self ) : <EOL> """<STR_LIT>""" <EOL> lgroup1 = self . h5file . root . lgroup1 <EOL> group2 = self . h5file . create_group ( '<STR_LIT:/>' , '<STR_LIT>' ) <EOL> lgroup1 . move ( group2 , '<STR_LIT>' ) <EOL> lgroup2 = self . h5file . root . group2 . lgroup2 <EOL> if common . verbose : <EOL> print ( "<STR_LIT>" , lgroup2 ) <EOL> self . assertTrue ( '<STR_LIT>' not in self . h5file ) <EOL> self . assertTrue ( '<STR_LIT>' in self . h5file ) <EOL> self . _checkEqualityGroup ( self . h5file . root . group1 , <EOL> self . h5file . root . group2 . lgroup2 ( ) ) <EOL> def test05_rename ( self ) : <EOL> """<STR_LIT>""" <EOL> lgroup1 = self . h5file . root . lgroup1 <EOL> lgroup1 . rename ( '<STR_LIT>' ) <EOL> lgroup2 = self . h5file . root . lgroup2 <EOL> if common . verbose : <EOL> print ( "<STR_LIT>" , lgroup2 ) <EOL> self . assertTrue ( '<STR_LIT>' not in self . h5file ) <EOL> self . assertTrue ( '<STR_LIT>' in self . h5file ) <EOL> self . _checkEqualityGroup ( self . h5file . root . group1 , <EOL> self . h5file . root . lgroup2 ( ) ) <EOL> def test06a_relative_path ( self ) : <EOL> """<STR_LIT>""" <EOL> self . h5file . create_group ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> lgroup3 = self . h5file . create_soft_link ( <EOL> '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ) <EOL> if common . verbose : <EOL> print ( "<STR_LIT>" , lgroup3 ) <EOL> self . assertTrue ( '<STR_LIT>' in self . h5file ) <EOL> self . _checkEqualityGroup ( self . h5file . root . group1 . group3 , <EOL> self . h5file . root . group1 . lgroup3 ( ) ) <EOL> def test06b_relative_path ( self ) : <EOL> """<STR_LIT>""" <EOL> self . h5file . create_group ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> lgroup3 = self . h5file . create_soft_link ( <EOL> '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ) <EOL> if common . verbose : <EOL> print ( "<STR_LIT>" , lgroup3 ) <EOL> self . assertTrue ( '<STR_LIT>' in self . h5file ) <EOL> self . _checkEqualityGroup ( self . h5file . root . group1 . group3 , <EOL> self . h5file . root . group1 . lgroup3 ( ) ) <EOL> def test07_walkNodes ( self ) : <EOL> """<STR_LIT>""" <EOL> links = [ node . _v_pathname for node in <EOL> self . h5file . walk_nodes ( '<STR_LIT:/>' , classname = "<STR_LIT>" ) ] <EOL> if common . verbose : <EOL> print ( "<STR_LIT>" , links ) <EOL> self . assertEqual ( links , [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] ) <EOL> links = [ node . _v_pathname for node in <EOL> self . h5file . walk_nodes ( '<STR_LIT:/>' , classname = "<STR_LIT>" ) ] <EOL> if common . verbose : <EOL> print ( "<STR_LIT>" , links ) <EOL> self . assertEqual ( links , [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] ) <EOL> def test08__v_links ( self ) : <EOL> """<STR_LIT>""" <EOL> links = [ node for node in self . h5file . root . _v_links ] <EOL> if common . verbose : <EOL> print ( "<STR_LIT>" , links ) <EOL> self . assertEqual ( len ( links ) , <NUM_LIT:2> ) <EOL> links = [ node for node in self . h5file . root . group1 . _v_links ] <EOL> if common . verbose : <EOL> print ( "<STR_LIT>" , links ) <EOL> self . assertEqual ( links , [ '<STR_LIT>' ] ) <EOL> def test09_link_to_link ( self ) : <EOL> """<STR_LIT>""" <EOL> lgroup2 = self . h5file . create_soft_link ( <EOL> '<STR_LIT:/>' , '<STR_LIT>' , '<STR_LIT>' ) <EOL> self . assertTrue ( lgroup2 ( ) is self . h5file . get_node ( '<STR_LIT>' ) ) <EOL> if common . verbose : <EOL> print ( "<STR_LIT>" , lgroup2 ( ) ) <EOL> self . assertTrue ( lgroup2 ( ) ( ) is self . h5file . get_node ( '<STR_LIT>' ) ) <EOL> if common . verbose : <EOL> print ( "<STR_LIT>" , lgroup2 ( ) ( ) ) <EOL> def test10_copy_link_to_file ( self ) : <EOL> """<STR_LIT>""" <EOL> fname = tempfile . mktemp ( "<STR_LIT>" ) <EOL> h5f = tables . open_file ( fname , "<STR_LIT:a>" ) <EOL> h5f . create_array ( '<STR_LIT:/>' , '<STR_LIT>' , [ <NUM_LIT:1> , <NUM_LIT:2> ] ) <EOL> h5f . create_group ( '<STR_LIT:/>' , '<STR_LIT>' ) <EOL> lgroup1 = self . h5file . root . lgroup1 <EOL> lgroup1_ = lgroup1 . copy ( h5f . root , '<STR_LIT>' ) <EOL> self . assertTrue ( '<STR_LIT>' in self . h5file ) <EOL> self . assertTrue ( '<STR_LIT>' in h5f ) <EOL> self . assertTrue ( lgroup1_ in h5f ) <EOL> if common . verbose : <EOL> print ( "<STR_LIT>" , lgroup1_ , '<STR_LIT>' , lgroup1_ . _v_file . filename ) <EOL> h5f . close ( ) <EOL> os . remove ( fname ) <EOL> def test11_direct_attribute_access ( self ) : <EOL> """<STR_LIT>""" <EOL> larr1 = self . h5file . get_node ( '<STR_LIT>' ) <EOL> arr1 = self . h5file . get_node ( '<STR_LIT>' ) <EOL> self . assertTrue ( larr1 . shape == ( <NUM_LIT:2> , ) ) <EOL> self . assertTrue ( larr1 [ : ] == [ <NUM_LIT:1> , <NUM_LIT:2> ] ) <EOL> larr1 [ <NUM_LIT:0> ] = - <NUM_LIT:1> <EOL> self . assertTrue ( arr1 [ : ] == [ - <NUM_LIT:1> , <NUM_LIT:2> ] ) <EOL> def test12_access_child_node_attributes ( self ) : <EOL> """<STR_LIT>""" <EOL> lgroup1 = self . h5file . get_node ( '<STR_LIT>' ) <EOL> arr2 = self . h5file . get_node ( '<STR_LIT>' ) <EOL> self . assertTrue ( lgroup1 . arr2 [ : ] == [ <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:3> ] ) <EOL> lgroup1 . arr2 [ <NUM_LIT:0> ] = - <NUM_LIT:1> <EOL> self . assertTrue ( arr2 [ : ] == [ - <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:3> ] ) <EOL> def test13_direct_attribute_access_via_chained_softlinks ( self ) : <EOL> """<STR_LIT>""" <EOL> lgroup1 = self . h5file . get_node ( '<STR_LIT>' ) <EOL> arr2 = self . h5file . get_node ( '<STR_LIT>' ) <EOL> l_lgroup1 = self . h5file . create_soft_link ( '<STR_LIT:/>' , '<STR_LIT>' , '<STR_LIT>' ) <EOL> self . assertTrue ( l_lgroup1 . arr2 [ : ] == [ <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:3> ] ) <EOL> l_lgroup1 . arr2 [ <NUM_LIT:0> ] = - <NUM_LIT:1> <EOL> self . assertTrue ( arr2 [ : ] == [ - <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:3> ] ) <EOL> def test14_child_of_softlink_to_group ( self ) : <EOL> """<STR_LIT>""" <EOL> group1 = self . h5file . get_node ( '<STR_LIT>' ) <EOL> lgroup1 = self . h5file . get_node ( '<STR_LIT>' ) <EOL> new_arr = self . h5file . create_array ( lgroup1 , '<STR_LIT>' , obj = [ <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:3> ] ) <EOL> new_arr2 = self . h5file . get_node ( '<STR_LIT>' ) <EOL> self . assertTrue ( new_arr2 [ : ] == [ <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:3> ] ) <EOL> def test_str ( self ) : <EOL> s = str ( self . h5file ) <EOL> self . assertEqual ( len ( re . findall ( '<STR_LIT>' , s ) ) , <NUM_LIT:3> ) <EOL> self . assertEqual ( len ( re . findall ( '<STR_LIT>' , s ) ) , <NUM_LIT:0> ) <EOL> def test_str_with_dangling_link ( self ) : <EOL> self . h5file . root . group1 . arr2 . remove ( ) <EOL> s = str ( self . h5file ) <EOL> self . assertEqual ( len ( re . findall ( '<STR_LIT>' , s ) ) , <NUM_LIT:3> ) <EOL> self . assertEqual ( len ( re . findall ( '<STR_LIT>' , s ) ) , <NUM_LIT:1> ) <EOL> @ unittest . skipIf ( tables . file . _FILE_OPEN_POLICY == '<STR_LIT:strict>' , <EOL> '<STR_LIT>' ) <EOL> class ExternalLinkTestCase ( common . TempFileMixin , TestCase ) : <EOL> def setUp ( self ) : <EOL> super ( ExternalLinkTestCase , self ) . setUp ( ) <EOL> self . extfname = tempfile . mktemp ( "<STR_LIT>" ) <EOL> self . exth5file = tables . open_file ( self . extfname , "<STR_LIT:w>" ) <EOL> self . _createFile ( ) <EOL> def tearDown ( self ) : <EOL> """<STR_LIT>""" <EOL> extfname = self . extfname <EOL> self . exth5file . close ( ) <EOL> super ( ExternalLinkTestCase , self ) . tearDown ( ) <EOL> os . remove ( extfname ) <EOL> def _createFile ( self ) : <EOL> self . h5file . create_array ( '<STR_LIT:/>' , '<STR_LIT>' , [ <NUM_LIT:1> , <NUM_LIT:2> ] ) <EOL> group1 = self . h5file . create_group ( '<STR_LIT:/>' , '<STR_LIT>' ) <EOL> self . h5file . create_array ( group1 , '<STR_LIT>' , [ <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:3> ] ) <EOL> extarr1 = self . exth5file . create_array ( '<STR_LIT:/>' , '<STR_LIT>' , [ <NUM_LIT:1> , <NUM_LIT:2> ] ) <EOL> self . assertTrue ( extarr1 is not None ) <EOL> extgroup1 = self . exth5file . create_group ( '<STR_LIT:/>' , '<STR_LIT>' ) <EOL> extarr2 = self . exth5file . create_array ( extgroup1 , '<STR_LIT>' , [ <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:3> ] ) <EOL> lgroup1 = self . h5file . create_external_link ( <EOL> '<STR_LIT:/>' , '<STR_LIT>' , '<STR_LIT>' % self . extfname ) <EOL> self . assertTrue ( lgroup1 is not None ) <EOL> larr1 = self . h5file . create_external_link ( <EOL> group1 , '<STR_LIT>' , '<STR_LIT>' % self . extfname ) <EOL> self . assertTrue ( larr1 is not None ) <EOL> larr2 = self . h5file . create_external_link ( '<STR_LIT:/>' , '<STR_LIT>' , extarr2 ) <EOL> self . assertTrue ( larr2 is not None ) <EOL> self . exth5file . close ( ) <EOL> self . exth5file = tables . open_file ( self . extfname , "<STR_LIT:r>" ) <EOL> def test00_create ( self ) : <EOL> """<STR_LIT>""" <EOL> self . _checkEqualityGroup ( self . exth5file . root . group1 , <EOL> self . h5file . root . lgroup1 ( ) ) <EOL> self . _checkEqualityLeaf ( self . exth5file . root . arr1 , <EOL> self . h5file . root . group1 . larr1 ( ) ) <EOL> self . _checkEqualityLeaf ( self . h5file . root . lgroup1 ( ) . arr2 , <EOL> self . h5file . root . larr2 ( ) ) <EOL> def test01_open ( self ) : <EOL> """<STR_LIT>""" <EOL> self . _reopen ( ) <EOL> self . _checkEqualityGroup ( self . exth5file . root . group1 , <EOL> self . h5file . root . lgroup1 ( ) ) <EOL> self . _checkEqualityLeaf ( self . exth5file . root . arr1 , <EOL> self . h5file . root . group1 . larr1 ( ) ) <EOL> self . _checkEqualityLeaf ( self . h5file . root . lgroup1 ( ) . arr2 , <EOL> self . h5file . root . larr2 ( ) ) <EOL> def test02_remove ( self ) : <EOL> """<STR_LIT>""" <EOL> self . exth5file . close ( ) <EOL> self . exth5file = tables . open_file ( self . extfname , "<STR_LIT:a>" ) <EOL> self . exth5file . root . arr1 . remove ( ) <EOL> self . assertTrue ( '<STR_LIT>' not in self . exth5file ) <EOL> if common . verbose : <EOL> print ( "<STR_LIT>" , self . h5file . root . group1 . larr1 ) <EOL> self . assertTrue ( '<STR_LIT>' in self . h5file ) <EOL> self . h5file . root . group1 . larr1 . remove ( ) <EOL> self . assertTrue ( '<STR_LIT>' not in self . h5file ) <EOL> def test03_copy ( self ) : <EOL> """<STR_LIT>""" <EOL> root = self . h5file . root <EOL> lgroup1 = root . lgroup1 <EOL> lgroup2 = lgroup1 . copy ( '<STR_LIT:/>' , '<STR_LIT>' ) <EOL> self . assertTrue ( '<STR_LIT>' in self . h5file ) <EOL> self . assertTrue ( '<STR_LIT>' in self . h5file ) <EOL> self . assertTrue ( '<STR_LIT>' in root . _v_children ) <EOL> self . assertTrue ( '<STR_LIT>' in root . _v_links ) <EOL> if common . verbose : <EOL> print ( "<STR_LIT>" , lgroup2 ) <EOL> lgroup1 . remove ( ) <EOL> self . _checkEqualityGroup ( self . exth5file . root . group1 , <EOL> self . h5file . root . lgroup2 ( ) ) <EOL> def test03_overwrite ( self ) : <EOL> """<STR_LIT>""" <EOL> root = self . h5file . root <EOL> lgroup1 = root . lgroup1 <EOL> lgroup2 = lgroup1 . copy ( '<STR_LIT:/>' , '<STR_LIT>' ) <EOL> lgroup2 = lgroup1 . copy ( '<STR_LIT:/>' , '<STR_LIT>' , overwrite = True ) <EOL> self . assertTrue ( '<STR_LIT>' in self . h5file ) <EOL> self . assertTrue ( '<STR_LIT>' in self . h5file ) <EOL> self . assertTrue ( '<STR_LIT>' in root . _v_children ) <EOL> self . assertTrue ( '<STR_LIT>' in root . _v_links ) <EOL> if common . verbose : <EOL> print ( "<STR_LIT>" , lgroup2 ) <EOL> lgroup1 . remove ( ) <EOL> self . _checkEqualityGroup ( self . exth5file . root . group1 , <EOL> self . h5file . root . lgroup2 ( ) ) <EOL> def test04_move ( self ) : <EOL> """<STR_LIT>""" <EOL> lgroup1 = self . h5file . root . lgroup1 <EOL> group2 = self . h5file . create_group ( '<STR_LIT:/>' , '<STR_LIT>' ) <EOL> lgroup1 . move ( group2 , '<STR_LIT>' ) <EOL> lgroup2 = self . h5file . root . group2 . lgroup2 <EOL> if common . verbose : <EOL> print ( "<STR_LIT>" , lgroup2 ) <EOL> self . assertTrue ( '<STR_LIT>' not in self . h5file ) <EOL> self . assertTrue ( '<STR_LIT>' in self . h5file ) <EOL> self . _checkEqualityGroup ( self . exth5file . root . group1 , <EOL> self . h5file . root . group2 . lgroup2 ( ) ) <EOL> def test05_rename ( self ) : <EOL> """<STR_LIT>""" <EOL> lgroup1 = self . h5file . root . lgroup1 <EOL> lgroup1 . rename ( '<STR_LIT>' ) <EOL> lgroup2 = self . h5file . root . lgroup2 <EOL> if common . verbose : <EOL> print ( "<STR_LIT>" , lgroup2 ) <EOL> self . assertTrue ( '<STR_LIT>' not in self . h5file ) <EOL> self . assertTrue ( '<STR_LIT>' in self . h5file ) <EOL> self . _checkEqualityGroup ( self . exth5file . root . group1 , <EOL> self . h5file . root . lgroup2 ( ) ) <EOL> def test07_walkNodes ( self ) : <EOL> """<STR_LIT>""" <EOL> self . h5file . create_soft_link ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ) <EOL> links = [ node . _v_pathname for node in <EOL> self . h5file . walk_nodes ( '<STR_LIT:/>' , classname = "<STR_LIT>" ) ] <EOL> if common . verbose : <EOL> print ( "<STR_LIT>" , links ) <EOL> self . assertEqual ( links , [ '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' , '<STR_LIT>' ] ) <EOL> links = [ node . _v_pathname for node in <EOL> self . h5file . walk_nodes ( '<STR_LIT:/>' , classname = "<STR_LIT>" ) ] <EOL> if common . verbose : <EOL> print ( "<STR_LIT>" , links ) <EOL> self . assertEqual ( links , [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] ) <EOL> def test08__v_links ( self ) : <EOL> """<STR_LIT>""" <EOL> links = [ node for node in self . h5file . root . _v_links ] <EOL> if common . verbose : <EOL> print ( "<STR_LIT>" , links ) <EOL> self . assertEqual ( len ( links ) , <NUM_LIT:2> ) <EOL> links = [ node for node in self . h5file . root . group1 . _v_links ] <EOL> if common . verbose : <EOL> print ( "<STR_LIT>" , links ) <EOL> self . assertEqual ( links , [ '<STR_LIT>' ] ) <EOL> def test09_umount ( self ) : <EOL> """<STR_LIT>""" <EOL> link = self . h5file . root . lgroup1 <EOL> self . assertTrue ( link . extfile is None ) <EOL> enode = link ( ) <EOL> self . assertTrue ( enode is not None ) <EOL> self . assertTrue ( link . extfile is not None ) <EOL> link . umount ( ) <EOL> self . assertTrue ( link . extfile is None ) <EOL> def test10_copy_link_to_file ( self ) : <EOL> """<STR_LIT>""" <EOL> h5fname2 = tempfile . mktemp ( "<STR_LIT>" ) <EOL> try : <EOL> with tables . open_file ( h5fname2 , "<STR_LIT:a>" ) as h5file2 : <EOL> h5file2 . create_array ( '<STR_LIT:/>' , '<STR_LIT>' , [ <NUM_LIT:1> , <NUM_LIT:2> ] ) <EOL> h5file2 . create_group ( '<STR_LIT:/>' , '<STR_LIT>' ) <EOL> lgroup1 = self . h5file . root . lgroup1 <EOL> lgroup1_ = lgroup1 . copy ( h5file2 . root , '<STR_LIT>' ) <EOL> self . assertTrue ( '<STR_LIT>' in self . h5file ) <EOL> self . assertTrue ( '<STR_LIT>' in h5file2 ) <EOL> self . assertTrue ( lgroup1_ in h5file2 ) <EOL> if common . verbose : <EOL> print ( "<STR_LIT>" , lgroup1_ , '<STR_LIT>' , <EOL> lgroup1_ . _v_file . filename ) <EOL> finally : <EOL> if os . path . exists ( h5fname2 ) : <EOL> os . remove ( h5fname2 ) <EOL> def suite ( ) : <EOL> """<STR_LIT>""" <EOL> theSuite = unittest . TestSuite ( ) <EOL> niter = <NUM_LIT:1> <EOL> for i in range ( niter ) : <EOL> theSuite . addTest ( unittest . makeSuite ( HardLinkTestCase ) ) <EOL> theSuite . addTest ( unittest . makeSuite ( SoftLinkTestCase ) ) <EOL> theSuite . addTest ( unittest . makeSuite ( ExternalLinkTestCase ) ) <EOL> return theSuite <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> import sys <EOL> common . parse_argv ( sys . argv ) <EOL> common . print_versions ( ) <EOL> unittest . main ( defaultTest = '<STR_LIT>' ) </s>
