<s> import unittest <EOL> from dash_test_util import * <EOL> from dashlivesim . dashlib import dash_proxy <EOL> from re import findall <EOL> from operator import mul <EOL> from dashlivesim . dashlib import mpdprocessor <EOL> class TestXlinkPeriod ( unittest . TestCase ) : <EOL> def setUp ( self ) : <EOL> self . old_set_baseurl = mpdprocessor . SET_BASEURL <EOL> mpdprocessor . SET_BASEURL = True <EOL> def tearDown ( self ) : <EOL> mpdprocessor . SET_BASEURL = self . old_set_baseurl <EOL> def testMpdPeriodReplaced ( self ) : <EOL> "<STR_LIT>" <EOL> collectresult = <NUM_LIT:1> <EOL> for k in [ <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:5> , <NUM_LIT:10> ] : <EOL> nr_period_per_hour = <NUM_LIT:10> <EOL> nr_xlink_periods_per_hour = k <EOL> urlParts = [ '<STR_LIT>' , '<STR_LIT>' % nr_period_per_hour , '<STR_LIT>' % nr_xlink_periods_per_hour , '<STR_LIT>' , '<STR_LIT>' ] <EOL> dp = dash_proxy . DashProvider ( "<STR_LIT>" , urlParts , None , VOD_CONFIG_DIR , CONTENT_ROOT , now = <NUM_LIT> ) <EOL> d = dp . handle_request ( ) <EOL> period_id_all = findall ( '<STR_LIT>' , d ) <EOL> one_xlinks_for_how_many_periods = nr_period_per_hour / nr_xlink_periods_per_hour <EOL> period_id_xlinks = [ int ( x [ <NUM_LIT:1> : ] ) % one_xlinks_for_how_many_periods for x in period_id_all ] <EOL> result = reduce ( mul , period_id_xlinks , <NUM_LIT:1> ) <EOL> collectresult = result * collectresult <EOL> self . assertTrue ( collectresult != <NUM_LIT:0> ) </s>
