<s> import os <EOL> import poioapi . io . elan <EOL> import poioapi . io . graf <EOL> class TestElan : <EOL> """<STR_LIT>""" <EOL> def setup ( self ) : <EOL> self . filename = os . path . join ( os . path . dirname ( __file__ ) , "<STR_LIT:..>" , "<STR_LIT>" , <EOL> "<STR_LIT>" , "<STR_LIT>" ) <EOL> self . basedirname = os . path . dirname ( self . filename ) <EOL> self . metafile = os . path . join ( os . path . dirname ( __file__ ) , "<STR_LIT:..>" , "<STR_LIT>" , <EOL> "<STR_LIT>" , "<STR_LIT>" ) <EOL> self . elan = poioapi . io . elan . Parser ( self . filename ) <EOL> def test_get_root_tiers ( self ) : <EOL> root_tiers = self . elan . get_root_tiers ( ) <EOL> assert len ( root_tiers ) == <NUM_LIT:4> <EOL> def test_get_child_tiers_for_tier ( self ) : <EOL> root_tiers = self . elan . get_root_tiers ( ) <EOL> tier = root_tiers [ <NUM_LIT:1> ] <EOL> child_tier = self . elan . get_child_tiers_for_tier ( tier ) <EOL> assert len ( child_tier ) == <NUM_LIT:2> <EOL> def test_get_annotations_for_tier ( self ) : <EOL> root_tier = self . elan . get_root_tiers ( ) [ <NUM_LIT:1> ] <EOL> root_tier_annotations = self . elan . get_annotations_for_tier ( root_tier ) <EOL> assert len ( root_tier_annotations ) == <NUM_LIT:15> <EOL> annotation = root_tier_annotations [ <NUM_LIT:0> ] <EOL> child_tier = self . elan . get_child_tiers_for_tier ( root_tier ) [ <NUM_LIT:0> ] <EOL> child_tier_annotations = self . elan . get_annotations_for_tier ( child_tier , annotation ) <EOL> assert len ( child_tier_annotations ) == <NUM_LIT:12> <EOL> def test_get_annotations_for_tier_with_parent ( self ) : <EOL> root_tiers = self . elan . get_root_tiers ( ) <EOL> child_tiers = self . elan . get_child_tiers_for_tier ( root_tiers [ <NUM_LIT:1> ] ) <EOL> parent_annotation = poioapi . io . graf . Annotation ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> child_tier_annotations = self . elan . get_annotations_for_tier ( child_tiers [ <NUM_LIT:1> ] , parent_annotation ) <EOL> assert len ( child_tier_annotations ) == <NUM_LIT:1> <EOL> assert child_tier_annotations [ <NUM_LIT:0> ] . id == "<STR_LIT>" <EOL> def test_tier_has_regions ( self ) : <EOL> root_tiers = self . elan . get_root_tiers ( ) <EOL> child_tiers = self . elan . get_child_tiers_for_tier ( root_tiers [ <NUM_LIT:1> ] ) <EOL> tier = child_tiers [ <NUM_LIT:0> ] <EOL> has_regions = self . elan . tier_has_regions ( tier ) <EOL> assert has_regions == True <EOL> def test_region_for_annotation ( self ) : <EOL> root_tier = self . elan . get_root_tiers ( ) [ <NUM_LIT:1> ] <EOL> root_tier_annotations = self . elan . get_annotations_for_tier ( root_tier ) <EOL> annotation = root_tier_annotations [ <NUM_LIT:0> ] <EOL> regions = self . elan . region_for_annotation ( annotation ) <EOL> expected_regions = ( <NUM_LIT> , <NUM_LIT> ) <EOL> assert regions == expected_regions <EOL> def test__annotation_for_region ( self ) : <EOL> annotation = self . elan . _annotation_for_region ( "<STR_LIT>" , <NUM_LIT> , <NUM_LIT> ) <EOL> assert annotation . attrib [ "<STR_LIT>" ] == "<STR_LIT>" </s>
