<s> """<STR_LIT>""" <EOL> import pytest <EOL> from docx . opc . packuri import PackURI <EOL> class DescribePackURI ( object ) : <EOL> def cases ( self , expected_values ) : <EOL> """<STR_LIT>""" <EOL> uri_str_cases = [ <EOL> '<STR_LIT:/>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> ] <EOL> if len ( expected_values ) != len ( uri_str_cases ) : <EOL> msg = "<STR_LIT>" <EOL> raise AssertionError ( msg ) <EOL> pack_uris = [ PackURI ( uri_str ) for uri_str in uri_str_cases ] <EOL> return zip ( pack_uris , expected_values ) <EOL> def it_can_construct_from_relative_ref ( self ) : <EOL> baseURI = '<STR_LIT>' <EOL> relative_ref = '<STR_LIT>' <EOL> pack_uri = PackURI . from_rel_ref ( baseURI , relative_ref ) <EOL> assert pack_uri == '<STR_LIT>' <EOL> def it_should_raise_on_construct_with_bad_pack_uri_str ( self ) : <EOL> with pytest . raises ( ValueError ) : <EOL> PackURI ( '<STR_LIT>' ) <EOL> def it_can_calculate_baseURI ( self ) : <EOL> expected_values = ( '<STR_LIT:/>' , '<STR_LIT>' , '<STR_LIT>' ) <EOL> for pack_uri , expected_baseURI in self . cases ( expected_values ) : <EOL> assert pack_uri . baseURI == expected_baseURI <EOL> def it_can_calculate_extension ( self ) : <EOL> expected_values = ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ) <EOL> for pack_uri , expected_ext in self . cases ( expected_values ) : <EOL> assert pack_uri . ext == expected_ext <EOL> def it_can_calculate_filename ( self ) : <EOL> expected_values = ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ) <EOL> for pack_uri , expected_filename in self . cases ( expected_values ) : <EOL> assert pack_uri . filename == expected_filename <EOL> def it_knows_the_filename_index ( self ) : <EOL> expected_values = ( None , None , <NUM_LIT:1> ) <EOL> for pack_uri , expected_idx in self . cases ( expected_values ) : <EOL> assert pack_uri . idx == expected_idx <EOL> def it_can_calculate_membername ( self ) : <EOL> expected_values = ( <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> ) <EOL> for pack_uri , expected_membername in self . cases ( expected_values ) : <EOL> assert pack_uri . membername == expected_membername <EOL> def it_can_calculate_relative_ref_value ( self ) : <EOL> cases = ( <EOL> ( '<STR_LIT:/>' , '<STR_LIT>' , '<STR_LIT>' ) , <EOL> ( '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' ) , <EOL> ( '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' ) , <EOL> ) <EOL> for baseURI , uri_str , expected_relative_ref in cases : <EOL> pack_uri = PackURI ( uri_str ) <EOL> assert pack_uri . relative_ref ( baseURI ) == expected_relative_ref <EOL> def it_can_calculate_rels_uri ( self ) : <EOL> expected_values = ( <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> ) <EOL> for pack_uri , expected_rels_uri in self . cases ( expected_values ) : <EOL> assert pack_uri . rels_uri == expected_rels_uri </s>
