#NEWLINE# def test_add_subregion( self ) : #NEWLINE# #INDENT# cnt_skip_subs = ( lambda x : len ( [ s for s in x . subregions if s . skip ] ) ) #NEWLINE# cnt_usr_subs = ( lambda x : ( len ( x . subregions ) - cnt_skip_subs ( x ) ) ) #NEWLINE# vs = VideoSequence ( 1 , 1 ) #NEWLINE# self . assertEqual ( cnt_usr_subs ( vs ) , 0 ) #NEWLINE# self . assertEqual ( cnt_skip_subs ( vs ) , 1 ) #NEWLINE# vs . add_subregion ( Subregion ( 0 , 0.1 ) ) #NEWLINE# self . assertEqual ( cnt_usr_subs ( vs ) , 1 ) #NEWLINE# self . assertEqual ( cnt_skip_subs ( vs ) , 1 ) #NEWLINE# vs = VideoSequence ( 1 , 1 ) #NEWLINE# vs . add_subregion ( Subregion ( 0.9 , 1 ) ) #NEWLINE# self . assertEqual ( cnt_usr_subs ( vs ) , 1 ) #NEWLINE# self . assertEqual ( cnt_skip_subs ( vs ) , 1 ) #NEWLINE# vs = VideoSequence ( 1 , 1 ) #NEWLINE# vs . add_subregion ( Subregion ( 0 , 1 ) ) #NEWLINE# self . assertEqual ( cnt_usr_subs ( vs ) , 1 ) #NEWLINE# self . assertEqual ( cnt_skip_subs ( vs ) , 0 ) #NEWLINE# vs = VideoSequence ( 1 , 2 ) #NEWLINE# vs . add_subregion ( Subregion ( 0 , 0.5 ) ) #NEWLINE# vs . add_subregion ( Subregion ( 0.5 , 0.6 ) ) #NEWLINE# self . assertEqual ( cnt_usr_subs ( vs ) , 2 ) #NEWLINE# self . assertEqual ( cnt_skip_subs ( vs ) , 1 ) #NEWLINE# vs = VideoSequence ( 1 , 2 ) #NEWLINE# vs . add_subregion ( Subregion ( 0.5 , 0.6 ) ) #NEWLINE# vs . add_subregion ( Subregion ( 0 , 0.1 ) ) #NEWLINE# self . assertEqual ( cnt_usr_subs ( vs ) , 2 ) #NEWLINE# self . assertEqual ( cnt_skip_subs ( vs ) , 2 ) #NEWLINE# vs = VideoSequence ( 1 , 3 ) #NEWLINE# vs . add_subregion ( Subregion ( 0 , 0.1 ) ) #NEWLINE# self . assertEqual ( cnt_usr_subs ( vs ) , 1 ) #NEWLINE# self . assertEqual ( cnt_skip_subs ( vs ) , 1 ) #NEWLINE# vs . add_subregion ( Subregion ( 0.9 , 1 ) ) #NEWLINE# self . assertEqual ( cnt_usr_subs ( vs ) , 2 ) #NEWLINE# self . assertEqual ( cnt_skip_subs ( vs ) , 1 ) #NEWLINE# vs . add_subregion ( Subregion ( 0.66 , 0.66 ) ) #NEWLINE# self . assertEqual ( cnt_usr_subs ( vs ) , 3 ) #NEWLINE# self . assertEqual ( cnt_skip_subs ( vs ) , 2 ) #NEWLINE# vs = VideoSequence ( 1 , 3 ) #NEWLINE# vs . add_subregion ( Subregion ( 0.66 , 0.66 ) ) #NEWLINE# self . assertEqual ( cnt_usr_subs ( vs ) , 1 ) #NEWLINE# self . assertEqual ( cnt_skip_subs ( vs ) , 2 ) #NEWLINE# vs . add_subregion ( Subregion ( 0 , 0.1 ) ) #NEWLINE# self . assertEqual ( cnt_usr_subs ( vs ) , 2 ) #NEWLINE# self . assertEqual ( cnt_skip_subs ( vs ) , 2 ) #NEWLINE# vs . add_subregion ( Subregion ( 0.9 , 1 ) ) #NEWLINE# self . assertEqual ( cnt_usr_subs ( vs ) , 3 ) #NEWLINE# self . assertEqual ( cnt_skip_subs ( vs ) , 2 ) #NEWLINE# vs = VideoSequence ( 1 , 4 ) #NEWLINE# vs . add_subregion ( Subregion ( 0.25 , 0.5 ) ) #NEWLINE# vs . add_subregion ( Subregion ( 0.5 , 0.75 ) ) #NEWLINE# self . assertEqual ( cnt_usr_subs ( vs ) , 2 ) #NEWLINE# self . assertEqual ( cnt_skip_subs ( vs ) , 2 ) #NEWLINE# vs . add_subregion ( Subregion ( 0 , 0.25 ) ) #NEWLINE# self . assertEqual ( cnt_usr_subs ( vs ) , 3 ) #NEWLINE# self . assertEqual ( cnt_skip_subs ( vs ) , 1 ) #NEWLINE# vs . add_subregion ( Subregion ( 0.75 , 1 ) ) #NEWLINE# self . assertEqual ( cnt_usr_subs ( vs ) , 4 ) #NEWLINE# self . assertEqual ( cnt_skip_subs ( vs ) , 0 ) #NEWLINE# vs = VideoSequence ( 1 , 5 ) #NEWLINE# vs . add_subregion ( Subregion ( 0.2 , 0.4 ) ) #NEWLINE# vs . add_subregion ( Subregion ( 0.6 , 0.8 ) ) #NEWLINE# self . assertEqual ( cnt_usr_subs ( vs ) , 2 ) #NEWLINE# self . assertEqual ( cnt_skip_subs ( vs ) , 3 ) #NEWLINE# vs . add_subregion ( Subregion ( 0.4 , 0.6 ) ) #NEWLINE# self . assertEqual ( cnt_usr_subs ( vs ) , 3 ) #NEWLINE# self . assertEqual ( cnt_skip_subs ( vs ) , 2 ) #NEWLINE# vs . add_subregion ( Subregion ( 0.8 , 1 ) ) #NEWLINE# self . assertEqual ( cnt_usr_subs ( vs ) , 4 ) #NEWLINE# self . assertEqual ( cnt_skip_subs ( vs ) , 1 ) #NEWLINE# vs . add_subregion ( Subregion ( 0 , 0.2 ) ) #NEWLINE# self . assertEqual ( cnt_usr_subs ( vs ) , 5 ) #NEWLINE# self . assertEqual ( cnt_skip_subs ( vs ) , 0 )