
    3j                      d dl mZ d dlZd dlZd dlZd dlZd dlZd dlmZ d dl	m
Z
 d dl	mZ d dl	mZ d dl	mZ d dl	mZ d d	l	mZ d d
l	mZ d dlmZ d dlmZ d dlmZ d dlmZ d dlmZ d dlmZ d dlmZ d dlmZ d dlmZ d dlmZ d dlmZ d dlmZ d dlmZ d dlmZ d dlm Z  d dlm!Z! d dlm"Z" d dlm#Z# d dlm$Z$ d dlm%Z% d dlm&Z& d d lm'Z' d d!lm(Z( d d"lm)Z) d d#lm*Z* d d$lm+Z+ d d%lm,Z, d d&lm-Z-m.Z. d d'l/m0Z0 d d(l1m2Z3  ejh                  d)      Z5 G d* d+ejl                        Z7 G d, d-ejl                        Z8e9d.k(  r ejt                  e8d/       yy)0    )annotationsN)GeneralNote)StreamException)Stream)Voice)Measure)Score)Part)Opus)bar)Music21Object)beam)chord)clef)common)	converter)corpus)defaults)duration)dynamics)environment)expressions)
instrument)interval)layout)key)metadata)meter)note)pitch)sites)spanner)tempo)texttie)variant)Music21Exception_SplitTuple)m21ToXml)	translatezstream.testsc                  R    e Zd ZdZd Zd Zd Zd Zd Zd Z	d Z
d	 Zd
 Zd Zd Zy)TestExternalTc                   t               }t        j                  d      }t               }t        j                  d      }d|_        |j                  |g d       t        j                  |d      }|j                  d|       |j                  d|       |j                  d|       | j                  r|j                  d	       y y )
N3/4quartertype   r            TallowTreble8vbr   lily.png)r   r   TimeSignaturer   NoteoctaverepeatInsertr   bestClefinsertshow)selfatsbqbestCs         A/DATA/.local/lib/python3.12/site-packages/music21/stream/tests.pytestLilySimplezTestExternal.testLilySimpleF   s    H  'HII9%	q,'a5	E	B	A99FF:     c                   t               }t        j                  d      }t               }t        j                  d      }t        j                         }d|_        t        j                         }d|g|_	        d|g|_
        d|_        |j
                  j                  |       t        d      D ]P  }|j                  t        j                   |             t#        j$                  |dz
        |j&                  |   _        R d|j&                  d   j
                  j*                  d   _        d	|j&                  d
   j
                  j*                  d   _        d|j&                  d   _        t/        j0                  |d      }|j3                  d|       |j3                  d|       |j3                  d|       | j4                  r|j5                  d       y y )N3/8eighthr1   r3   r7   r6   startr   stopza real CTr8   r:   )r   r   r;   r   r<   r   Durationr2   TuplettupletActualtupletNormalr=   appendTupletrangeappendcopydeepcopyr    
Accidentalelements
accidentaltupletslyricr   r?   r@   rA   )	rB   rC   rD   rE   rF   dur1tup1irG   s	            rH   testLilySemiComplexz TestExternal.testLilySemiComplexW   sf   H  'HII8$  "	 II	

%qAHHT]]1%&','7'7A'>AJJqM$  29

1&&q).28

2''*/(

1a5	E	B	A99FF: rJ   c                   t        j                  d      }t        j                  d      }t        j                  d      }t	               }|j                  t        j                  |             |j                  t        j                  |             t	               }|j                  t        j                  |             |j                  t        j                  |             t               }|j                  |       |j                  |       |j                  |       | j                  r|j                  d       yy)zG
        Test the lilypond output of various score operations.
        C4D42/4r:   N)r   r<   r   r;   r
   rW   rX   rY   r	   r@   rA   )rB   cdrD   s1s2score1s          rH   testScoreLilyzTestExternal.testScoreLilyw   s     IIdOIIdO  'V
		$--"#
		$--"#V
		$--"#
		$--"#bbb99KK
# rJ   c                   t               }t        d      D ]J  }t               }dD ](  }t        j                  |      }|j                  |       * |j                  |       L | j                  r|j                          yy)zH
        A simple test of adding notes to measures in a stream.
           )rC   gc#a#N)r   rV   r   r   r<   rW   rA   )rB   rg   dummyrE   prC   s         rH   testMXOutputzTestExternal.testMXOutput   sf     H1XE	A+IIaL , HHQK  99FFH rJ   c           
     F   t        j                         }d|_        t               }|j	                  |t        t        ddd                   |j                  dt        j                  d             |j                  dt        j                  d             |j                  dt        j                  d             |j                  dt        j                  d	             |j                  d
t        j                  d             | j                  r|j                          yy)f
        A test of the automatic partitioning of notes in a measure and the creation of ties.
        r7   r   x   5/4
   rf   3/16   9/8(   10/4N)r   r<   quarterLengthr   r>   listrV   r@   r   r;   rA   )rB   nrC   s      rH   testMxMeasureszTestExternal.testMxMeasures   s    
 IIKH	q$uQQ/01 	
E''./	U((/0	E''/0	U((/0	U((0199FFH rJ   c                h   t               }t               }g ddz  D ]\  }t        j                  |      }d|_        |j	                  |       t        j                  |      }d|_        |j	                  |       ^ t               }|j                  |       |j                  |       |j                  dt        j                  d             |j                  dt        j                  d             |j                  d	t        j                  d             | j                  r|j                          y
y
)za
        Test the creation of multipart streams by simply having streams within streams.
        c3a3g#4d2ry         ?g      ?r   r/   r7   rx      N	r   r   r<   r   rW   r@   r   r;   rA   )rB   rF   rxr   mss          rH   testMultipartStreamsz!TestExternal.testMultipartStreams   s     HH*R/A		!A"AOHHQK		!A#AOHHQK 0 H			E''./	E''./	E''./99FFH rJ   c                   t        j                  dd      }d}d}|j                  d   j                  }||   }|||dz    }|j                  d   j                  }||   }|||dz    }	|j                  d   j                  }
||
   }|||dz    }t	               }|j                  |       |j                  |	       |j                  |       | j                  r|j                          yy)zs
        This demonstrates obtaining slices from a stream and layering
        them into individual parts.
        zmozart/k155r6   r      r5   N)r   parsepartsidr   rW   rA   )rB   
k155_scorestart_measureend_measureviolin_i_idviolin_i_partviolin_i_part_sliceviolin_ii_idviolin_ii_partviolin_ii_part_sliceviola_part_id
viola_partviola_part_slicer   s                 rH   testMultipartMeasuresz"TestExternal.testMultipartMeasures   s    
 \\-3
 &&q),,";/+M+/J!''*--#L1-mK!OL"((+...
%mK!ODH	$%	%&	!"99FFH rJ   c                >   g ddz  }t               }d}d}t        d      D ]]  }t               }|D ]/  }t        j                  |      }d|_        |j                  |       1 ||_        |j                  |       ||z  }_ | j                  r|j                          yy)a4  
        A test of creating a canon with shifted presentations of a source melody.
        This also demonstrates
        the addition of rests to parts that start late or end early.

        The addition of rests happens with makeRests(), which is called in
        musicxml generation of a Stream.
        rg   g#d-f#efrn         ?r            ?N)	r   rV   r   r<   r   rW   offsetr@   rA   )	rB   rC   r   partOffsetShift
partOffsetjunkrs   	pitchNamer   s	            rH   
testCanonszTestExternal.testCanons   s     .1H
!HDA	IIi("%  "AHHHQK/)J  99FFH rJ   c                   t               }g ddz  D ]/  }t        j                  d      }||_        |j	                  |       1 t               }|j                  |       |j                  dt        j                  d             |j                  dt        j                  d             |j                  dt        j                  d	             | j                  r|j                          y
y
)zl
        This demonstrates a partial beam; a beam that is not connected between more than one note.
        )      ?r   r   r   r   r      rg   r   r/   r7   rx   r   4/4Nr   )rB   rF   r   r   r   s        rH   testBeamsPartialzTestExternal.testBeamsPartial   s     H9B>A		#AAOHHQK ?
 H		E''./	E''./	E''./99FFH rJ   c                   t               }t               }t               }g ddz  D ]  }t        j                  |      }t        j                  dg      |_        |j                  |       t        j                  |      }d|_        |j                  |       t        j                  |      }d|_        |j                  |        t               }|j                  |       |j                  |       |j                  |       |j                  dt        j                  d             |j                  dt        j                  d	             |j                  d
t        j                  d             | j                  t        |j                         j                        d       | j                  r|j                          yy)zG
        A test of beams applied to different time signatures.
        r   r   c#4d3r   r         ?r   r   r/   r7   rx   r   r   ih  N)r   r   r<   randomchoicer   rW   r@   r   r;   assertEquallenrecursenotesrA   )	rB   rF   r   rs   r   r   r   or   s	            rH   testBeamsStreamzTestExternal.testBeamsStream  s;    HHH*R/A		!A$mmTF3AOHHQK		!A!AOHHQK		!A#AOHHQK 0 H				E''./	E''./	E''./QYY[../599FFH rJ   c                    t               }t        j                  d      |_        t	        j
                         }d|_        |j                  |d       |j                         }| j                  r|j                          y y )Nr   r   r   )
r   r   r;   timeSignaturer   r<   r   repeatAppend	makeBeamsrA   )rB   aMeasureaNotebMeasures       rH   testBeamsMeasurezTestExternal.testBeamsMeasure1  sb    9!&!4!4U!;		"eR(%%'99MMO rJ   N)__name__
__module____qualname__rA   rI   rb   rl   rt   r   r   r   r   r   r   r    rJ   rH   r-   r-   C   s@    D"@$(&288(@rJ   r-   c                  J   e Zd Zd Zd Zd Zd Zd Zd Zd Z	d Z
d	 Zd
 Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Z d Z!d  Z"d! Z#d" Z$d# Z%d$ Z&d% Z'd& Z(d' Z)d( Z*d) Z+d* Z,d+ Z-d, Z.d- Z/d. Z0d/ Z1d0 Z2d1 Z3d2 Z4d3 Z5d4 Z6d5 Z7d6 Z8d7 Z9d8 Z:d9 Z;d: Z<d; Z=d< Z>d= Z?d> Z@d? ZAd@ ZBdA ZCdB ZDdC ZEdD ZFdE ZGdF ZHdG ZIdH ZJdI ZKdJ ZLdK ZMdL ZNdM ZOdN ZPdO ZQdP ZRdQ ZSdR ZTdS ZUdT ZVdU ZWdV ZXdW ZYdX ZZdY Z[dZ Z\d[ Z]d\ Z^d] Z_d^ Z`d_ Zad` Zbda Zcdb Zddc Zedd Zfde Zgdf Zhdg Zidh Zjdi Zkdj Zldk Zmdl Zndm Zodn Zpdo Zqdp Zrdq Zsdr Ztds Zudt Zvdu Zwdv Zxdw Zydx Zzdy Z{dz Z|d{ Z}d| Z~d} Zd~ Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd ZdÄ ZdĄ Zdń ZdƄ ZdǄ ZdȄ ZdɄ Zdʄ Zd˄ Zd̄ Zd̈́ Zd΄ Zdτ ZdЄ Zdф Zd҄ Zdӄ ZdԄ ZdՄ Zdք Zdׄ Zd؄ Zdل Zdڄ Zdۄ Zd܄ Zd݄ Zdބ Zd߄ Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zed        Zd Zd Zd Zd Z d Zd Zd  Zd Zd Zd Zd Zy(  Testc                X   t               }t        d      D ]  }|j                  dt                       | j	                  |j
                         t        j                  d      |d<   | j	                  |j
                         t               |d<   | j                  |j
                         y )Nr3   r   C#r6   r7   )	r   rV   r@   r   
assertTrueisFlatr   r<   assertFalse)rB   rC   rr   s      rH   
testIsFlatzTest.testIsFlat?  su    H1XEHHQ( !yy!!x!"rJ   c                    t               }t               dg}| j                  t              5 }|j	                  |       d d d        | j                  dt        j                               y # 1 sw Y   /xY w)Nhelloz'hello')r   r   assertRaisesr   rW   assertInstr	exception)rB   rC   otherscontexts       rH   testAppendFailszTest.testAppendFailsI  sX    H/7+/7HHV 0iW%6%6!78 0/s   A,,A5c                   t               }|j                  t        j                  d      g d       |j                  t        j                  d      g d       | j	                  |j
                         |j                         }| j                  |j
                         d}|D ]!  }||j                   d|j                   dz  }# | j                  |d       y )	Nr   )               @      @zD-)      ?      @      @ z: z; z60.0: C#; 1.0: D-; 2.0: C#; 3.0: D-; 4.0: C#; 5.0: D-; )r   r>   r   r<   r   isSortedsortedr   r   namer   )rB   r   yro   	myElements        rH   testSortzTest.testSortQ  s    H	tyy8	tyy8$HHJ

#II$$%R	'7r::A TUrJ   c                   t               }d|_        t               }d|_        t               }d|_        t        j                  dd      }t        j                  dd      }t        j                  d	d      }t        j                  d
d      }d|_        d|_        d|_        d|_        |j                  |       |j                  |       |j                  |       |j                  |       d|_        |j                  |       |j                  |       |j                         }d|_        | j                  t        |      d       |d   |u sJ y )Nri   p1p2Chalfr1   Dr0   EFn1n2n3n4      4@zflat s1rn   r5   )r	   r   r
   r   r<   rW   r   r@   flattenr   r   )	rB   ri   r   r   r   r   r   r   sf1s	            rH   testFlatSimplezTest.testFlatSimple]  s	   WVVYYs(YYs+YYs+YYs(
		"
		"
		"
		"	
		"
		"jjl 	S1%1v||rJ   c                   t               }t        d      D ]l  }t               }t        d      D ]=  }t               }|j                  t               g d       |j	                  |dz  |       ? |j	                  |dz  |       n | j                  t        |      d       | j                  t        |j                               d       |j                         }| j                  |d   j                  d       y)	zQ
        This test used to be in OMIT_FROM_DOCS in the flatten() doctest
        r3   )r   r5   r6   r7   rn   ry   d   }   |   g     {@N)
r   rV   r>   r   r@   r   r   r   assertAlmostEqualr   )rB   r   jrF   ra   rs   	flatteneds          rH   testFlattenDocTestzTest.testFlattenDocTest  s     HqAA1XH}@R#  HHQWa   	Q#QYY[)3/IIK	y~44e<rJ   c                   t               }|j                  dt        j                                | j	                  |d   j
                  |       t               }t        d      D ]Q  }t        j                  |      }|dz  |_	        |j                  |       | j	                  |j                  |dz         S | j	                  |j                  d       | j	                  |d   j                  |      d       | j	                  |d   j                  |      d       | j	                  |d   d   j                  |d         d       | j	                  t        |j                        d       |j                         }y )Nr7   r   r6   ry   r5         $@r   )r   r@   r   r<   r   
activeSiterV   rX   rY   r   getOffsetBySiter   r!   r   )rB   	srcStream	midStreamr   srcNews        rH   testActiveSiteCopiedStreamsz Test.testActiveSiteCopiedStreams  s;   H	DIIK(100)<H	qA]]9-F FFMV$V]]AF3  	))1- 	155i@!D155i@$G 	1a881FL 	Y__-q1 rJ   c                <   t               }t               }t        j                         }|j                  d|       |j                  d|       | j	                  |j                         d   |       | j                  |j                         d   j                  d       y )Nry      r         6@)r   r   r<   r@   assertIsr   r   r   )rB   st1st2r   s       rH   testSimpleRecursezTest.testSimpleRecurse  sq    hhYY[

2r

2sckkmA&+q)00$7rJ   c                    | j                  t              5  t        j                         }t	        |dg       d d d        y # 1 sw Y   y xY wNr   )r   r   r   r<   r   )rB   r   s     rH   testStreamExceptionsOnAssertz!Test.testStreamExceptionsOnAssert  s2    /BB7O 0//s   "AA
c                r   t               }t        d      D ]L  }t        j                  d      }t	        j
                  d      |_        |dz  |_        |j                  |       N | j                  t        |      d       | j                  t        |j                               d       | j                  |j                         d   j                  d       t               }t        d      D ]2  }t        j                  |      }|dz  |_        |j                  |       4 | j                  t        |      d       | j                  t        |j                               d       |j                         }| j                  |d	   j                  |      d
       t               }t        d	      D ]2  }t        j                  |      }|dz  |_        |j                  |       4 | j                  t        |      d	       | j                  t        |j                               d       |j                         D 	cg c]  }	|	j                   }
}	t        t        d            }|t        d      D cg c]  }|dz   	 c}z  }|t        d      D cg c]  }|dz   	 c}z  }|t        d      D cg c]  }|dz   	 c}z  }|t        d      D cg c]  }|dz   	 c}z  }|t        d      D cg c]  }|dz   	 c}z  }| j                  |
d t        |       |       y c c}	w c c}w c c}w c c}w c c}w c c}w )Nr   G#r0   r5   r   rn   ry               &@r     r{   r   n   )r   rV   r   r<   r   rQ   r   r@   r   r   r   r   rX   rY   r  r   )rB   r  r   r   r  r  mfs	farStreammidNewrC   offsetsoffsetsMatchs               rH   testStreamRecursionzTest.testStreamRecursion  s   H	qA		$A!**95AJ1uAHQ	  	Y+Y..0115**,Q/66< H	qA]]9-FFFMV$ 
 	Y+Y..0126!Q//4d;H	qA]]9-FGFMV$ 
 	Y+Y..0137 &/%6%6%89%8188%89 E!H~q2AR22q2AR22q2AR22%(3(QS(33%(3(QS(33!3#l"34lC : 32233s$   8L/L L%-L*L/+L4c                
   t               }t        d      D ]  }t               }t        d      D ]u  }t               }t        d      D ]F  }t        j                  d      }t	        j
                  d      |_        |j                  |dz  |       H |j                  |dz  |       w |j                  |dz  |        |j                         }|D 	cg c]  }	|	j                   }
}	|
d d }| j                  |g d       y c c}	w )	Nrn   r  r0   r6   r3      r{   )r   r6   rn   r3   r   r  	   ry      r  r(        r,  r      r-        r/  )
r   rV   r   r<   r   rQ   r@   r   r   r   )rB   r"  r   r  r   
nearStreamzr   fs_fsrC   r$  offsetsBriefs               rH   testStreamSortRecursionzTest.testStreamSortRecursion  s    H	qAI1X#X
qA		$A!)!2!29!=AJ%%a!eQ/ "   Q
3  QVY/  !!#%*+U188U+s|K	L ,s   D c                N   t               }dD ]\  \  }}t        j                  d      }t        j                         |_        ||j                  _        ||_        |j                  |       ^ |j                         }| j                  |ddgdgdgg       |j                  |      }y )N))r   r  )r7   r6   )r*  r7   r  r5   r6   r   )r   r   r<   r   rQ   r   r   r@   _findLayeringr   _consolidateLayering)rB   rC   r   durr   
overlapMaprr   s          rH   testOverlapsAzTest.testOverlapsA  s    H5KFC		$A!**,AJ'*AJJ$AHHHQK 6 __&
q!fqcA3%78&&z2rJ   c                "   t               }t        d      D ]L  }t        j                  d      }t	        j
                  d      |_        |dz  |_        |j                  |       N |j                         }| j                  t        |      d       y )Nrn   r  r0   r5   r   )r   rV   r   r<   r   rQ   r   r@   getOverlapsr   r   )rB   rC   r   r   rh   s        rH   testOverlapsBzTest.testOverlapsB$  sm    HqA		$A!**95AJ1uAHHHQK	 
 MMOQ#rJ   c                   t               }t        j                  d      }|j                  |g d       | j	                  |j
                  d       | j	                  |j                  d       | j	                  |j                  j                  d       t        j                  d      }| j	                  |j                  d       ||_        | j	                  |j                  j                  d       | j	                  |j                  d       y )	Nr0   r1   r4   r7   rn   r   r   r   )
r   r   r<   r>   r   highestOffsethighestTimer   r   rQ   )rB   rC   rF   newDurations       rH   testStreamDurationzTest.testStreamDurationF  s    HII9%	q,'!,*1137''/22C8 
1137*rJ   c                   ddl m} t               }t        j                  d      }|j                  |       | j                  |j                  j                  d       t        j                         }|f|j                  _
        | j                  |j                  j                   |dd             | j                  |j                  j                   |dd             ||f|j                  _
        | j                  |j                  j                   |dd             |j                          | j                  |j                  j                   |dd             y )	Nr   Fractionr   r   r6   r7   rn   r)  )	fractionsrE  r   r   r<   rW   r   r   r   rR   r]   coreElementsChanged)rB   rE  r   r   tups        rH   testStreamDurationRecalculatedz#Test.testStreamDurationRecalculatedU  s    &HIIC(	1137oo!V

118Aq>B118Aq>B "3Z

118Aq>B	118Aq>BrJ   c                   t        j                  d      }t        j                  d      }t        j                  d      }t        j                         |_        t        j                         |_        t        j                         |_        d|j                  j
                  z  |j                  _        d|j                  j
                  z  |j                  _        d|j                  j
                  z  |j                  _        t               }|j                  |       |j                  |       |j                  |       | j                  |d   j                  d|j                  j
                  z         | j                  |d   j                  d|j                  j
                  z  d|j                  j
                  z  z          y	)
zX
        An approach to setting TimeSignature measures in offsets and durations
        r/   rx   rf   r{   ry   r3   r5   r6   N)
r   r;   r   rQ   barDurationr   r   rW   r   r   )rB   rC   rE   rg   r   s        rH   testMeasureStreamzTest.testMeasureStreami  sH    &&&&&(
&&(
&&(
 $&(C(C#C

 #%(C(C#C

 #$q}}'B'B#B

 H			1rAMM,G,G'GI1Q]]-H-H(H*,q}}/J/J*J(L 	NrJ   c                   t               }t               }g ddz  D ]\  }t        j                  |      }d|_        |j	                  |       t        j                  |      }d|_        |j	                  |       ^ t               }|j                  |       |j                  |       |j                  dt        j                  d             |j                  dt        j                  d             |j                  d	t        j                  d             | j                  t        |j                         j                        d
       t        j                  d      }t        j                  |      }|d   dd }	|d   dd }
|d   dd }t               }|	|
|fD ]%  }|D ]  }|j                  |j                   |         ' y)z
        Test the creation of streams with multiple parts. See versions
        of this tests in TestExternal for more details
        r   ry   r   r5   r   r/   r7   rx   r   P   corelli/opus3no1/1graver  r3   r,  r{   N)r   r   r<   r   rW   r@   r   r;   r   r   r   r   r   getWorkr   r   r   )rB   rF   r   r   r   r   r   thisWorkrC   rE   rg   rh   rj   stream_caser   s                  rH   testMultipartStreamzTest.testMultipartStream  sk   
 HH*R/A		!A"AOHHQK		!AAOHHQK 0 H			E''./	E''./	E''./QYY[../4>>";<OOH%aD2JaDBKaDBK X q!9K 		!((A& ! %rJ   c                   t        j                  d      }|d   }| j                  |t               | j	                  |j
                  |       | j                  |d   t               | j                  |d   j
                  |       t               }t               }g ddz  D ]p  }t        j                  |      }t        j                  dg      |_        |j                  |       t        j                  |      }d|_        |j                  |       r t               }|j                  |       |j                  |       | j	                  |j
                  |       | j	                  |j
                  |       y)	a  
        Test activeSite relationships.

        Note that here we see why sometimes qualified class names are needed.
        This test passes fine with class names Part and Measure when run interactively,
        creating a Test instance. When run from the command line
        Part and Measure do not match, and instead music21.stream.Part has to be
        employed instead.
        rP  r   r,  r   r   r   r   N)r   r   assertIsInstancer
   r   r
  r   r  r   r   r<   r   r   r   rW   r@   )	rB   rC   rE   rF   r   r   r   r   r   s	            rH   testActiveSiteszTest.testActiveSites  s    LL23aDa&q) 	aeW-adooq) HH*R/A		!A$mmTF3AOHHQK		!A!AOHHQK 0 H		q)q)rJ   c                J   t               }t               }t        j                  d      }d|_        |j	                  |       |j	                  |       | j                  |j                  |      |j                  |             | j                  |j                  |      d       y)z=
        Test an object having multiple activeSites.
        r  ry   N)r   r   r<   r   r@   r   r  )rB   rC   rE   r   s       rH   testActiveSitesMultiplezTest.testActiveSitesMultiple  s     HHIIdO		 	**1-q/@/@/CD**1-r2rJ   c                h   t        j                  t        j                  d            }|j                  d   }|j                         }|j                  t        j                        D ]  }|j                  |_
         t        j                  |      }| j                  |j                  d      d       y )NrP  r5   z	A A G F ET)r   r   r   rQ  r   r   getElementsByClassr   r<   r   r^   r$   assembleLyricsr   
startswith)rB   rC   rE   rg   thisNotetextStrs         rH   testExtractedNoteAssignLyricz!Test.testExtractedNoteAssignLyric  s    OOFNN+DEFGGAJIIK,,TYY7H%]]HN 8%%a(++K8	rJ   c                    t        j                  d      }|j                  d   }|j                         }| j	                  |j
                  d       | j	                  |j
                  d       y)z=
        Test getting an instrument from an mxl file
        zcorelli/opus3no1/1grave.xmlr6   zViolone e OrganoN)r   r   r   getInstrumentr   partName)rB   rC   rE   instObjs       rH   testGetInstrumentFromMxlzTest.testGetInstrumentFromMxl  sZ     LL67GGAJ //#))+=>%78rJ   c                   t               }t               }g ddz  D ]p  }t        j                  |      }t        j                  dg      |_        |j                  |       t        j                  |      }d|_        |j                  |       r t               }|j                  |       |j                  |       |j                         }| j                  |j                  t        j                         |j                         }| j                  |j                  t        j                         |j                         }| j                  |j                  t        j                         t        j                         }|j                  |      j                  d      }	|j                  |      j                  d      }	|j                  |      j                  d      }	y )Nr   r,  r   r   utf-8)r   r   r<   r   r   r   rW   r@   rb  r   rc  r   r*   GeneralObjectExporterr   decode)
rB   rF   r   r   r   r   r   rd  GEX	unused_mxs
             rH   testGetInstrumentManualzTest.testGetInstrumentManual  s[   
 HH*R/A		!A$mmTF3AOHHQK		!A!AOHHQK 0 H		//#))8+<+<=//#))8+<+<=//#))8+<+<= ,,.IIaL''0	IIaL''0	 IIaL''0	rJ   c           
     t   t        j                         }d|_        t               }|j	                  |t        t        ddd                   |j                  dt        j                  d             |j                  dt        j                  d             |j                  dt        j                  d             |j                  dt        j                  d	             |j                  d
t        j                  d             t        j                         }|j                  |      j                  d      }y)rv   r7   r   rw   rx   ry   rf   rz   r{   r|   r}   r~   rg  Nr   r<   r   r   r>   r   rV   r@   r   r;   r*   rh  r   ri  rB   r   rC   rj  rk  s        rH   testMeasureAndTieCreationzTest.testMeasureAndTieCreation)  s    
 IIKH	q$uQQ/01	E''./	U((/0	E''/0	U((/0	U((01,,.IIaL''0	rJ   c                |   t               }t               }g ddz  D ]p  }t        j                  |      }t        j                  dg      |_        |j                  |       t        j                  |      }d|_        |j                  |       r t               }|j                  |       |j                  |       t        j                  |      }t               }|D ]^  }	t        j                  d|	t        |	j                        g       t        j                  |	      }
|j                  |	j                  |
       ` y)z'
        Test copying a stream
        r   r   r   r   z copying and inserting an elementN)r   r   r<   r   r   r   rW   r@   rX   rY   environLocal
printDebugr   r!   r   )rB   rF   r   r   r   r   r   unused_wpostaElementbElements              rH   testStreamCopyzTest.testStreamCopy;  s     HH*R/A		!A$mmTF3AOHHQK		!A!AOHHQK 0 H		 ==#xH##%G%-s8>>/B%D E}}X.HKK2	 rJ   c                   t               }t               }g ddz  D ]p  }t        j                  |      }t        j                  dg      |_        |j                  |       t        j                  |      }d|_        |j                  |       r t               }|j                  |       |j                  |       t               }|j                  t               D ]  }|j                  |        t        j                  dt        |      g       d}	|D ]N  }|	dk\  rt        j                  d|	g        yt        j                  |g       |j                  d	
      }
~
|	dz  }	P y)ze
        This test was designed to illustrate a past problem with stream
        Iterations.
        r   r3   r   r   zexpected lengthr   rn   zinfinite loopT)searchActiveSiter5   N)r   r   r<   r   r   r   rW   r@   r[  rr  rs  r   rb  )rB   rF   r   r   r   r   srcrC   objcounterr   s              rH   testIterationzTest.testIteration\  s"   
 HH*Q.A		!A$mmTF3AOHHQK		!A!AOHHQK / h

1

1H))&1CHHSM 2 	!2CF ;<A!|'''(BC##QC(??D?9DqLG rJ   c           
        t        j                         }d|_        t               }d|_        |j                  dt        j                  d             |j                  dt        j                  d             |j                  dt        j                  d             |j                  dt        j                  d	             |j                  d
t        j                  d             |D cg c]  }|j                   }}| j                  |g d       |j                  |t        t        ddd                   |j                  d      }| j                  t        |      d       | j                  |d   j                  d       | j                  |d   j                  d       | j                  |d   j                   |       |D cg c]  }|j                   }}| j                  |g d       y c c}w c c}w )Nr7   Fr   rx   ry   rf   rz   r{   r|   r}   r~   )r   r	  r   r         D@rw   )sortByCreationTimer3   rn   )r   r<   r   r   autoSortr@   r   r;   r   r   r>   r   rV   getTimeSignaturesr   	numeratorr
  )rB   r   rC   r   r$  rE   s         rH   testGetTimeSignatureszTest.testGetTimeSignatures~  s   IIKH
	E''./	U((/0	E''/0	U((/0	U((01%&'Q188Q'">? 	
q$uQQ/0159Q#1+1,1!, &''Q188Q' 	">?% ( (s   *G1G6c                X   t               }|j                  dt                      | j                  t	        |      d       | j                  t	        |d   j
                        d       | j                  |d   j                  |      d       | j                  |d   j                  d       y)zB
        Test basic Elements wrapping non music21 objects
        2   r5   r   r6         I@N)r   r@   r   r   r   r!   r  r   )rB   rC   s     rH   testElementszTest.testElements  s     H	]_%Q# 	QqTZZ!,
 	1--a0$71d+rJ   c                T   t               }g ddz  D ](  }t        j                  |      }|j                  |       * t	        j
                  |      }| j                  |j                  d       |j                         }|d   j                  }| j                  |j                  d       y )Nr   r3   r   r   )	r   r   r<   rW   r   r?   r   signmakeMeasures)rB   r   r   r   clefObjmeasureStreams         rH   	testClefszTest.testClefs  s    H*Q.A		!AHHQK / --"s+("''s+rJ   c           
        t               }t        j                  d      }d|_        t	        j
                  g d      }d|_        |j                  d|       |j                  d|       |j                         }| j                  |d   |       | j                  |d   |       |j                  d      }| j                  t        |      d       | j                  |d   |       t        j                         }t               }|j                  d|d	|d
|g       |j                         }| j                  |d          |j                  d      }	| j                  t        |	      d       t               }
|
j                  d|d	|d|g       |
j                  d      }| j                  t        |      d       |
j                  dd      }| j                  t        |      d       d|_        t        j                  d      }t               }|j                  d|d	|d|g       |j                         }| j                  t        |      d       |j                  d      }| j                  t        |      d       | j                  |d   |       |j                  dd      }| j                  t        |      d       | j                  |d          t        j                  d      }d|_        d|_        t               }|j                  d|d	|d
|d|g       |j                         }| j                  t        |      d       |j                  d      }| j                  t        |      d       | j                  |d   |       t        j                  d      }t               }|j                  d|d	|d
|g       |j                  d      }| j                  t        |      d       |j                  dd      }| j                  t        |      d       |j                  dd      }| j                  t        |      d       | j                  |d   |       | j                  |d   |       t               }|j                  t        j                                |j                  t!        j"                  d             |j                         }| j%                  |g        t'               }|j)                  t        j                         d       |j+                  t        j                         g d       |j-                  d       t/        t1        |j3                         j4                              D ]  \  }}|j7                  |d        |j                         } | j                  | D !cg c]  }!t9        |!       c}!g d       |j                  t;        j<                  d              t?        |      }"|"jA                  d       t1        |"t&                 D ]  }#|#j-                  d        |"j                         }$g d!}%| j                  |$D !cg c]  }!t9        |!       c}!|%       tC        jD                  |"      }&tG        |"|&g      }|j                         }'| j                  |'D !cg c]  }!t9        |!       c}!|%d"gz   |%z          y c c}!w c c}!w c c}!w )#Nr   r5   c4e4g4rn   r   T)
skipChordsr   r   r   	skipRestsr6   r	  Fr7   )r  skipGapsry   zB-)r<  )r<  r  A#r   )skipUnisonsr  )noNone)r  r  )r  skipOctavesBr4   inPlace)	<music21.note.Note C><music21.note.Note C#><music21.note.Note D><music21.note.Note E->None<music21.note.Note E><music21.note.Note F><music21.note.Note F#><music21.note.Note G>rf   )r  r  r  r  r  r  r  r  r  r  r  r  )$r   r   r<   r   r   Chordr@   findConsecutiveNotesr  r   r   RestassertIsNonerW   r   Clefr   KeyassertSequenceEqualr   r   r>   
makeVoices	enumerater   r   r   	transposereprr   r;   r
   r  rX   rY   r	   )(rB   r   r   r   l1l2r1rj   l3l4s3l5l6r   s4l7l8l9r   s5l10l11n5s6l12l13l14s7l15r   ra   elemconsecr   rs   mmconsec2	expected2r   consec3s(                                           rH   testFindConsecutiveNoteszTest.testFindConsecutiveNotes  s   HYYt_[[+,	B	B##%beR beR ##t#4R!$beR YY[X
		3 	 $$&"Q% $$t$4R!$X
		3 	 $$u$5R!$$$td$CR!$YYt_X
		3 	 $$&R!$$$$6R!$beR $$$$GR!$"Q% YYt_X
		3 	 %%'S1%%%$%7S1%c!fb!YYt_X
		3 	 %%T%2S1%%%Tt%DS1%%%Tt%DS1%c!fb!c!fb!X
		$))+
		#''#,%%'  b) I	tyy{A&	tyy{L1	T" aiik&7&7!89GAtNN1dN+ : '')626a$q'62		
 	
$$U+,G	t$qz"BMM$M' #((*	 	737a$q'73Y? ]]11b'N((*737a$q'73Y&5II5UVS 3D 4 4s   .[[2[c                   t        j                  d      }t        j                  d      }t        j                         }t        j                  d      }t               }|j	                  ||||g       |j                  d      }| j                  t        |      d       |d   }| j                  |j                  d       | j                  |j                  j                  |       t        j                  d	      }t        j                  d
      }	t        ||	g      }
|
j                         }| j                  t        |      d       |j                         }| j                  |j                  d       | j                  |j                  |j                  d          | j                  |j                   |	j                  d          y )Nrd   D5B4Tr  r6   r   zMajor NinthC4 E4 G4zD4 F4 A4r5   zMajor Second)r   r<   r  r   rW   melodicIntervalsr   r   niceNamer  	noteStartr
  r   r  firstr   noteEnd)rB   r  d5r  b4ri   intS1M9ch1ch2rj   intS2major_seconds                rH   testMelodicIntervalszTest.testMelodicIntervalsC  sS   YYt_YYt_YY[YYt_X
		2r2r"###d#3UQ'1Xm4bll--r2 kk*%kk*%S#J##%UQ'{{}..?l,,ciil;l**CIIaL9rJ   c                    t        j                  dd      }|j                         }| j                  t	        |      d       y )Nztinynotation: 3/4 c4 d' r b b'FmakeNotationr6   )r   r   r  r   r   )rB   ri   r  s      rH   testMelodicIntervalsBzTest.testMelodicIntervalsB^  s5    __=ER##%UQ'rJ   c           
     j   t               }t        j                  d      }d|_        |j	                  |       | j                  t        |j                        d       |j                         }|j                  d       | j                  t        |j                         j                        d       |j                         }| j                  t        |j                         j                        d       | j                  |j                         j                  d   j                  d       t               }t        j                  d      }d	|_        |j	                  |       |j                         }|j                  d       t        j                  d
      |j                         j                  d   _        |j                         }| j                  t        |j                         j                        d       t        j                         }d|_        t               }|j                  |t!        t#        ddd                   | j                  t        |      d       |j%                  dt'        j(                  d             |j%                  dt'        j(                  d             |j%                  dt'        j(                  d             |j%                  dt'        j(                  d             |j%                  dt'        j(                  d             |j                         }	|	j                  d       | j                  t        |	j                         j                        d       |	j                         }
| j                  t        |
j                         j                        d       y )ND#2r   r5   Tr  r6   r   A4r  rN   r7   rw   r}   rx   ry   rf   rz   r{   r|   r~   A   )r   r   r<   r   rW   r   r   r   r  makeTiesr   	stripTiesr&   Tier   r>   r   rV   r@   r   r;   )rB   ri   r   sUntiedrj   r   s2Untiedr   rC   rE   rg   s              rH   testStripTiesBuiltAzTest.testStripTiesBuiltAc  s   XYYu
		"RXX*__
D!RZZ\//0!4,,.W__.445q9*003AA1EXYYt_
		"__
D!$'GGG$4

1!<<>X--/556:IIKH	q$uQQ/01Q$	E''./	U((/0	E''/0	U((/0	U((01NN	

4
  	QYY[../4KKMQYY[../4rJ   c                N   ddl m} t        j                  |j                        }|j
                  d   }| j                  t        |j                         j                        d       |j                  d       | j                  t        |j                         j                        d       |j
                  d   }| j                  t        |j                         j                        d       |j                  d      }| j                  t        |j                         j                        d	       | j                  t        |j                         j                        d       |j
                  d
   }| j                  t        |j                         j                        d       |j                  d       | j                  t        |j                         j                        d       |j
                  d   }| j                  t        |j                         j                        d       |j                         j                         }| j                  t        |j                         j                        d       | j                  t        |j                        d       y )Nr   testPrimitiver   Tr  r   r5   Fr3   r6   r7   ry   )music21.musicxmlr  r   r   multiMeasureTiesr   r   r   r   notesAndRestsr  r   )	rB   r  rC   r   r   
p2Strippedp3p4p4Notess	            rH   testStripTiesImportedAzTest.testStripTiesImportedA  s   2OOM::;WWQZRZZ\778"=
T"RZZ\778!<WWQZRZZ\778"=\\%\0
Z//1??@!DRZZ\778"=WWQZRZZ\778"=
T"RZZ\778!<WWQZRZZ\778"=,,.((*RZZ\778"=W223R8rJ   c                   t               }t               }|j                  |       t        j                  dd      }t        j                  d      |_        t        j                  dd      }t        j                  d      |_        t        j                  dd      }t        j                  d      |_        t        j                  dd      }|j                  ||||g       |j                  d       | j                  t        |j                         j                        d	       |j                  d
      }| j                  t        |j                         j                        d	       y)z
        Testing that ties are stripped from containers that are not Measures.
        https://github.com/cuthbertLab/music21/issues/266
        rd   r   rF  rN   continuerO   Tr  r6   FN)r   r   rW   r   r<   r&   r  r  r   r   r   r  )rB   r   vr   r   r   r   strippeds           rH   !testStripTiesNonMeasureContainersz&Test.testStripTiesNonMeasureContainers  s   
 HG	IId#. YYt3/$YYt3/YYt3/	!RR!	D!QYY[667;;;u;-X--/==>BrJ   c                   t        d      }t        d      }t        j                  d      }t        j                  d      }d|j                  _        d|j                  _        t        j                  d	      |_        t        j                  d
      |_        |j                  d|       |j                  d|       t        ||g      }|j                         }|t        j                     j                         }|j                  }| j                  |j                         | j                  |j                  d       | j                  |j
                  d       | j                  |j                  j                         y)zI
        After stripping ties, unlinked durations become linked.
        r5   numberr6   wholer1   r0   F      ?rN   rO   r   complexg      @N)r   r   r<   r   linkedr   r&   r  r@   r
   r  r  r   r   r2   r   )	rB   m1m2r   r   rs   
p_strippedr   rh   s	            rH   testStripTiesUnlinkedzTest.testStripTiesUnlinked  s    AAYYG$YYI&"$(!!
		!R
		!R"bN[[]
tyy!'')JJ!+$/++,rJ   c                   t               }t               }t               }t               }t        j                  d      }t        j                  d      |_        t        j                  d      }t        j                  d      |_        t        j                  d      }t        j                  d      }t        j                  d      |_        t        j                  d      }	t        j                  d      |	_        |j                  ||g       |j                  |||	g       |j                  |       |j                  d|       |j                  |       |j                         }
| j                  t        |
j                         j                        d       |
j                  d   j                   d   j                  d   }| j                  |j"                  d       | j%                  |j
                         |
j                  d   j                   d   j                  d   }| j                  |j"                  d       | j%                  |j
                         y	)
z
        Testing that ties are stripped from notes consecutive in a voice
        but not consecutive in a flattened parent stream.
        https://github.com/cuthbertLab/music21/issues/568
        r6   rF  rN   rO   r5   r   r7   rn   N)r	   r
   r   r   r<   r&   r  r  rW   r@   r  r   r   r   r  r   voicesr   r  )rB   r   rs   v1v2v1n1v1n2v2n1v2n2v2n3r  
voice1Note
voice2Notes                rH   +testStripTiesConsecutiveInVoiceNotContainerz0Test.testStripTiesConsecutiveInVoiceNotContainer  s    GFWWyyq)777#yyq)776?yyq)yyq)777#yyq)776?
		4,
		4t$%		B	;;=X--/==>B^^A&--a0>>qA
1115*..)^^A&--a0>>qA
1115*..)rJ   c                *   t               }t        j                  dd      }t        j                  dd      }t        j                  dd      }t        j                  d      |_        t        j                  dd      }t        j                  d      |_        t        j                  ||g      }t        j                  ||g      }|j                  ||g       |j                         }| j                  |j                  d   j                         y	)
z
        Testing ties NOT stripped where only some chord members are tied.
        https://github.com/cuthbertLab/music21/issues/502
        C5r   rF  Bb4C3rN   rO   r   N)r   r   r<   r&   r  r   r  rW   r  assertIsNotNoner   )	rB   r   r   r   r   r   c1c2r  s	            rH   !testStripTiesChordMembersSomeTiedz&Test.testStripTiesChordMembersSomeTied  s    
 HYYt3/YYuC0YYt3/!YYt3/[["b"[["b"	"b;;=X^^A.223rJ   c                Z   t               }t        j                  ddg      }|j                  t	        j
                  d             |j                  |       |j                  d       |j                         }| j                  t        |j                         j                        d       y)zI
        Testing ties stripped where all chord members are tied.
        r  r  z1/8Tr  r5   N)r   r   r  rW   r   r;   r  r  r   r   r   r   )rB   r   rg   r  s       rH    testStripTiesChordMembersAllTiedz%Test.testStripTiesChordMembersAllTied  s|    
 HKKt%	$$U+,		t$;;=X--/556:rJ   c                   t               }t        j                  ddg      }|j                  t	        j
                  d             |j                  |       |j                  d       |j                         j                  \  }}}}|j                  dt        j                  j                  ||             |j                  dt        j                  j                  ||             |j                  d      }|j                         j                  d   }| j!                  t#        |j$                  d         d       | j!                  t#        |j$                  d         d       | j'                  |j$                  d   j)                  |             | j'                  |j$                  d   j+                  |             | j'                  |j$                  d   j)                  |             | j'                  |j$                  d   j+                  |             | j-                  |j$                  d   |j$                  d          | j'                  |j$                  d   j)                  |             | j'                  |j$                  d   j+                  |             | j'                  |j$                  d   j)                  |             | j'                  |j$                  d   j+                  |             y	)
zT
        Testing elements in spanners replaced when stripTies removes them.
        r  r  z1/16Tr  r   Fr5   N)r   r   r  rW   r   r;   r  r   r   r@   music21r"   Slurr   	Crescendor  r   r   spannersr   isFirstisLastassertIsNot)	rB   r   rg   r   	unused_n2r   r   r  sn1s	            rH   #testStripTiesReplaceSpannedElementsz(Test.testStripTiesReplaceSpannedElements'  s9   
 HKKt%	$$V,-		t$ !		 1 1Ir2	GOO((R01	G$$..r267;;u;- &&q)X..q12A6X..q12A6))!,44S9:))!,33C89))!,44S9:))!,33C89 	A(9(9!(<=

1--b12

1,,R01

1--b12

1,,R01rJ   c                   t        j                  d      }|j                  d       | j                  |j                  j
                  d       |j                  d       | j                  |j                  j
                  d       |j                  d      d   }|j                  d       | j                  |t        j                     D cg c]  }t        |j
                         c}g d       y c c}w )NztinyNotation: c2~ c8 c8 c8 c8Tr  Fr   r   )z<music21.beam.Beams>0<music21.beam.Beams <music21.beam.Beam 1/start>>/<music21.beam.Beams <music21.beam.Beam 1/stop>>r/  r0  )r   r   r  r   streamStatusbeamsr  splitAtDurationsr   r   r<   r  )rB   rs   els      rH   testStripTiesClearBeamingzTest.testStripTiesClearBeamingF  s    OO;<	t$--t4	D!--u5t,Q/	D!1TYY<@<R$rxx.<@	
@s   C4c                   t        t        j                         g      }t        t        j                  d      g      }t        ||g      }t        |      }t        j                  d      |j                  j                         _        |j                  dd      }t        j                  d      |j                  j                         _        |j                  dd      }y)z
        Ensure stripTies() gracefully handles "stop" or "continue" tie types
        following rests as it flattens a stream.
        z
C4 E-4 B-4rO   F)r  matchByPitchr  N)r   r   r  r   r  r   r
   r&   r  r   r  r  )rB   r  r  r   rs   _s         rH   $testStripTiesStopTieChordFollowsRestz)Test.testStripTiesStopTieChordFollowsRestW  s    
 DIIK=!EKK-./RHG"wwvKKEK:"wwz2KKEK:rJ   c                   t        j                         }t        j                  d      }t	        j
                  d      }t               }|j                  d|       |j                  d|       |j                  d|       t        |j                  dd            }t        |j                  dd            }| j                  |d       | j                  |d       y)	zM
        Testing multiple zero-length elements with mustBeginInSpan:
        r   r6   r   T)mustBeginInSpanFr7   N)r   
TrebleClefr   r;   r   KeySignaturer   r@   r   getElementsByOffsetr   )rB   rg   rD   ksr   r  r  s          rH   !testGetElementsByOffsetZeroLengthz&Test.testGetElementsByOffsetZeroLengthe  s    
 OO  'a H	a	b	b&&sD&AB&&sE&BCQQrJ   c                x   ddl m} t        j                  |j                        }| j                  t        |j                        d       | j                  t        |j                  d   j                         j                        d       | j                  t        |j                  d   j                         j                        d       | j                  t        |j                  d   j                         j                        d       | j                  t        |j                  d   j                         j                        d       |j                  d	      }| j                  t        |j                  d   j                         j                        d
       | j                  t        |j                  d   j                         j                        d       | j                  t        |j                  d   j                         j                        d       | j                  t        |j                  d   j                         j                        d       | j                  t        |j                  d   j                         j                        d       | j                  t        |j                  d   j                         j                        d       | j                  t        |j                  d   j                         j                        d       | j                  t        |j                  d   j                         j                        d       |j                  d	       | j                  t        |j                  d   j                         j                        d
       | j                  t        |j                  d   j                         j                        d       | j                  t        |j                  d   j                         j                        d       | j                  t        |j                  d   j                         j                        d       t        j                  d      }| j                  t        |j                        d       | j                  t        |j                  d   j                         j                        d       | j                  t        |j                  d   j                         j                        d       | j                  t        |j                  d   j                         j                        d       | j                  t        |j                  d   j                         j                        d       |j                  d	       | j                  t        |j                  d   j                         j                        d       | j                  t        |j                  d   j                         j                        d       | j                  t        |j                  d   j                         j                        d       | j                  t        |j                  d   j                         j                        d       y)z7
        Test stripTies using the Score method
        r   r  rn   r   r5   r6   r7   Fr  r   r3   ry   Tbach/bwv66.6%   *   -   )   $   ,   N)r  r  r   r   r  r   r   r   r   r  r  r   )rB   r  r   sPosts       rH   testStripTiesScorezTest.testStripTiesScorev  s    	3 OOM::;QWWq)QWWQZ//1??@"EQWWQZ//1??@"EQWWQZ//1??@"EQWWQZ//1??@"E E*U[[^335CCDaHU[[^335CCDaHU[[^335CCDaHU[[^335CCDbI 	QWWQZ//1??@"EQWWQZ//1??@"EQWWQZ//1??@"EQWWQZ//1??@"E 	
D!QWWQZ//1??@!DQWWQZ//1??@!DQWWQZ//1??@!DQWWQZ//1??@"E LL(QWWq)QWWQZ//1??@"EQWWQZ//1??@"EQWWQZ//1??@"EQWWQZ//1??@"E 	
D!QWWQZ//1??@"EQWWQZ//1??@"EQWWQZ//1??@"EQWWQZ//1??@"ErJ   c                   t        j                  d      }t        j                  d      }t        j                  d      }t        j                  d      }t        j                  d      }t        j                  d      }||||||g}t               }|j                  t	        j
                  d             t        d      D ]Y  }	||	   }
|	dz  st        j                  d	      }||
_        t        |	d
z         }|j                  |
       |j                  |       [ |j                  d      }t        |j                         j                  t         j                              }| j                  t        |      d       | j                  |d   j                   |j                          | j                  |d   j"                  j$                  d       | j                  |d
   j                   |j                          | j                  |d   j                   |j                          | j                  |d   j                   |j                          | j                  |d   j                   |j                          y)zm
        Test whether strip ties merges some chords that are the same and
        some that are not.
        r  zC3 E3 G3z	C3 E-3 G3z	D4 F#4 A4zD4 F#41/4r   r6   rN   r5   r  Tr7  r3   r   r   r7   rn   N)r   r  r
   rW   r   r;   rV   r&   r  r   r  r   r   r[  r   r   pitchesr   r   )rB   ch0r  r  ch3ch4ch5chordsrs   ra   rg   tr   r   	chordsOuts                  rH   testStripTiesChordszTest.testStripTiesChords  s   
 kk*%kk*%kk*%kk+&kk+&kk(#sCc3/F	$$U+,qAq	Aq5GGG$q1u%AHHQKHHQK  [[d[+88EF	Y+1--s{{;1..<<cB1--s{{;1--s{{;1--s{{;1--s{{;rJ   c                P   t        j                  dd      }| j                  t        |j	                         j                         j                        d       |j	                         j                  d   j                  d      d   }| j                  t        |j                        d       | j                  |j                  d   j                  d       | j                  |j                  d	   j                  d
       | j                  |j                  d   j                  d       y)z~
        Make sure chords are matched even if some have 'natural' accidentals and some
        have None accidentals.
        zschoenberg/opus19r6   .   r   r   r   r7   r   r5         @r   N)
r   r   r   r   r  r   r   r   r[  r   )rB   schmeasures      rH   testStripTiesChordsAccidentalsz#Test.testStripTiesChordsAccidentals  s    
 ll.2S]]_446<<=rB--/''*==iHKW]]+Q/q)00#6q)00#6q)00#6rJ   c                X   t        j                  d      }t        j                  d      |_        t        j                  d      }t        j                  d      }t        j                  d      |_        t        j                  d      }t        j                  d      }t        j                  d      |_        t	        j
                  ||g      }t	        j
                  ||g      }t               }|j                  |       |j                  |       |j                  |       |j                  d      }	| j                  t        |	      d       |j                  d	      }
| j                  t        |
      d
       t        j                  d      |_        |j                  d      }| j                  t        |      d       | j                  t        |j                        d       |j                  d	      }| j                  t        |      d
       t        j                  d      |_        |j                  d	      }| j                  t        |      d       | j                  t        |j                        d       |j                  |t	        j
                  d             t        j                  d      |j                         _        |j                  d	      }| j                  t        |j                        d       |j                         j                  dd       |j                  d      }| j                  t        |j                        d       |d   j                  dd       |j                  d      }| j                  t        |j                        d       y)z
        Make sure tie types of "stop" or "continue" are not taken at face value
        for Chords if matchByPitch=False; they only represent that SOME
        chord member has that tie type.
        rd   rN   F4r  rO   TrM  r6   Fr7   z4(<music21.note.Note C>, <music21.chord.Chord C4 F4>)zC4 F4z(<music21.chord.Chord C4 F4>,)r   r  z;(<music21.chord.Chord F#4 B4>, <music21.chord.Chord C4 F4>)r5   r  zX(<music21.chord.Chord F#4 B4>, <music21.chord.Chord G4 C5>, <music21.chord.Chord C4 F4>)N)r   r<   r&   r  r   r  r   rW   r  r   r   r   r[   replacer  r  )rB   n0r   r   r   r   r  r  r   	stripped1	stripped2	stripped3	stripped4	stripped5	stripped6	stripped7	stripped8s                    rH   testStripTiesComplexTieszTest.testStripTiesComplexTies  s    YYt_!YYt_YYt_$YYt_YYt_[["b"[["b"H			KKTK2	 	Y+KKUK3	 	Y+$KKTK2	 	Y+	""#B	

 KKUK3	Y+KKUK3	Y+	""#B	
 	
		"ekk'*+(	KKUK3		""#,	
 	
	At,KKTK2		""#I	
 	
!q$'KKTK2		""#J	
rJ   c                f   ddl m} t        j                  d      }t	        j
                  d      |_        t        j                  d      }t	        j
                  d      |_        |j                         }|j                  dd       t               }|j                  d|       |j                  d	|       |j                  d	|       |j                  d
       |j                  d      }| j                  t        |t        j                           d       | j                  |t        j                     j                         j                  d       | j                  t        ||j                           d       | j                  ||j                     j                         j                  d       y )Nr   )harmonyr   rN   rO   T)	allow_addr   r   r  rM  r5   r6   )r#  rk  r   r<   r&   r  ChordSymbolbassr   r@   r  r  r   r   r  r   )rB   rk  r`  r   cs0r   r  s          rH   )testStripTiesIgnoresUnrealizedChordSymbolz.Test.testStripTiesIgnoresUnrealizedChordSymbol<  s=   #YYs^!YYs^ !!#%H	b	c	b	t$;;D;1Xdii0115$)),224BBAFXg&9&9:;Q?'"5"56<<>LLaPrJ   c                   ddl m}  |        |        |        |       f\  }}}} |        |        |        |       f\  }}}}	d|_        d|_        d|_        d|_        d|_        d|_        d	|_        d|	_        d
|	_        d|j                  _        d|j                  _        d|j                  _        d|j                  _        d|j                  _        d|j                  _        d|j                  _        d|	j                  _        t               }
|
j                  ||||g       t               }|j                  ||||	g       |
j                  |      }| j                  t        |      d       |j                  |d         j                         }| j                  ||       |
j                  |      }| j                  ||       |j                  |      }| j                  t        |      d       | j                  |d   |	       y )Nr   )r<   r   r   r   r   GAr  r3   r   r  rM   r7   r5   )music21.noter<   stepr=   r   r2   r   rW   simultaneousAttacksr   r   r>  r  r  playingWhenAttackedallPlayingWhileSounding)rB   r<   n11n12n13n14n21n22n23n24stream1stream2attackedTogetherr^  rw  rx  s                   rH   testTwoStreamMethodszTest.testTwoStreamMethodsS  s   % $?c3 $?c3
"#$""$#$(S#s+,(S#s+,"66w?-.2../?/BCIIKh$%99#>)3/")"A"A#"F45q9-a0#6rJ   c                	   t        j                  d      }|j                  d   j                  dd      }| j	                  t        |j                  t                    d       |j                  t              j                         }| j	                  t        |j                         j                  t        j                              d       | j	                  t        |j                         j                  t        j                              d       | j	                  t        |j                         j                  t        j                              d       |j                  d   }|j                  t              d   }| j	                  t!        t#        |j$                              d       | j	                  t        |j                               d       |j'                  d      }| j	                  t!        t#        |j$                              d       | j	                  t        |j                               d       |j                  t              d   }| j	                  t!        t#        |j$                              d       | j	                  t        |j                               d       t)               }t+        d      D ]C  }t               }	t-        j.                         }
|	j1                  |
d       |j3                  |	       E |j                  d	d      }| j	                  t        |      d	       t        j                  d      }|j                  d	d      }| j	                  t        |d   t        j                           d       | j	                  t        |d   t        j                           d       | j	                  t        |d	   t        j                           d       | j	                  t        |d   t        j                           d       | j	                  t        |d   t        j                           d       | j	                  t        |d   t        j                           d       | j	                  t        |d	   t        j                           d       | j	                  t        |d   t        j                           d       y )
Nbach/bwv324.xmlr7   rn   r   r5   r   r3   z.[<music21.note.Note B>, <music21.note.Note D>]r6   )r   r   r   measuresr   r   r[  r   r  r   r   r=  r   r;   r   r  r   r   r   r[  r   rV   r   r<   r   rW   )rB   rC   rE   unused_bMeasureFirstr   mExRawmExrg   rr   r   r   rh   s               rH   testMeasureRangezTest.testMeasureRange  s   LL*+GGAJ1%Q11':;Q?  !33G<BBDQYY[;;  !	# 	QYY[;;! "#$	& 	QYY[;;DIIFGK WWQZ&&w/2T&,,/02bcV^^-.2 jjmT#))_-/_`S[[]+Q/ &&w/2T&,,/02bcV^^-.2 H1XE	A		ANN1a HHQK	  JJq!Q# LL*+JJq!QqT$))_-q1QqT$))_-q1QqT$))_-q1QqT$))_-q1QqT#"2"234a8QqT#"2"234a8QqT#"2"234a8QqT#"2"234a8rJ   c                   t        j                  d      }|j                  d   j                         }| j	                  t        t        |j                                     g d       t        j                  d      }|j                         }| j	                  t        t        |j                                     g d       |j                         D ]   \  }}| j	                  t        |      d       " t        j                  d      }|j                  d   j                         j                  t        j                  g      }| j	                  t        t        |j                                     g d       | j	                  t        |d         d       | j	                  t        |d         d       |j                  d   j                  t              d	   }|j                  t        j                  g      }| j	                  t        t        |j                                     dg       |j                  d   j                  t              d
   }|j                  t        j                  g      }| j	                  t        t        |j                                     dg       |j                         j                  dg      }| j	                  t        |j                               g d       y )Nr  r   )	r   r          @      (@      0@r         8@      A@      C@rn   r   z'[<music21.stream.Measure 1 offset=0.0>]r   z'[<music21.stream.Measure 2 offset=4.0>]r5   r6   r  r<   )r   r   r   measureOffsetMapr   r   r   keysitemsr   r   r   r<   r   r[  r   )rB   rC   
mOffsetMap
unused_keyvaluer  r	  s          rH   testMeasureOffsetMapzTest.testMeasureOffsetMap  s;   LL*+WWQZ002
Z__%6 78L	N LL*+'')
Z__%6 78L	N ",!1!1!3JSZ+ "4
 LL*+ WWQZ'')::DII;G
Z__%6 78L	N 	Z_-/XYZ_-/XY WWQZ**73A6(($))5
 	Z__%6 783%@WWQZ**73A6(($))5
Z__%6 783%@YY[116(;

 12L	NrJ   c                   t        j                  d      }|j                  d   }d}| j                  t	        |j                         j                        |       g d}|j                         }| j                  t        t        |j                                     |       |j                         j                  t        t        j                  g      }| j                  t        t        |j                                     |       |j                  d   j                         }| j                  t	        |j                         j                        |dz
         |j                         j                  d   j                  t              j                   }| j                  |d       |j                         j                  d   j                  t              j                   }| j                  |d       |j                         j                  d   j                  t              j                   }| j                  |d	       |j                  t        g      }| j                  t        |j                               |       y )
Nzbach/bwv4.8r5   4   )r   r   r         "@      *@r  r   r        <@      ?@      @@      B@r  g      F@r6   r7   r   r,  rn   )r   r   r   r   r   r   r  r  r   r   r  r   r   r<   r  getContextByClassr  )rB   rC   altocountedAltoNotescorrectMeasureOffsetMapru  altoPostTiemNos           rH   testMeasureOffsetMapPostTiez Test.testMeasureOffsetMapPostTie  s   LL' wwqzT\\^99:<LM#G $$&TYY[ 124KL ||~../CDTYY[ 124KL ggaj**,[002@@ACSVWCWX !!#11!4FFwOVVa !!#11!4FFwOVVa !!#11"5GGPWWa  ++WI6diik*,CDrJ   c                   g ddz  }d}t               }|D ]/  }t        j                  |      }d|_        |j	                  |       1 ||_        |j                          |j                  dd      }|j                  ddgd	       | j                  |j                  d       | j                  |j                  d
       t        j                         }|j                  |      j                  d      }t               }	d}
d}t!        d      D ]]  }t               }|D ]/  }t        j                  |      }d|_        |j	                  |       1 ||_        |	j#                  |       ||
z  }_ |j                  |      j                  d      }y)P
        Test output tests above just by calling the musicxml attribute
        r   rn         @r   T)searchContextr  r   r  )refStreamOrTimeRanger        Y@rg  r   r6   N)r   r   r<   r   rW   r   transferOffsetToElementsr  	makeRestsr   lowestOffsetr@  r*   rh  r   ri  rV   r@   )rB   rC   r   rs   r   r   r   rj  rk  r   r   unused_xs               rH   "testMusicXMLGenerationViaPropertyAz'Test.testMusicXMLGenerationViaPropertyA  sZ    .1
HI		)$A!AOHHQK  	""$""$"O	!S4@+.,,.IIaL''0	 H
aHA	IIi("%  "AHHHQK/)J ! IIaL''0	rJ   c           
     t   t        j                         }d|_        t               }|j	                  |t        t        ddd                   |j                  dt        j                  d             |j                  dt        j                  d             |j                  dt        j                  d             |j                  dt        j                  d	             |j                  d
t        j                  d             t        j                         }|j                  |      j                  d      }y)r  r7   r   rw   rx   ry   rf   rz   r{   r|   r}   r~   rg  Nrn  ro  s        rH   "testMusicXMLGenerationViaPropertyBz'Test.testMusicXMLGenerationViaPropertyB?  s     IIKH	q$uQQ/01	E''./	U((/0	E''/0	U((/0	U((01,,.IIaL''0	rJ   c                p   g ddz  }t               }d}d}d}t        d      D ]]  }t               }|D ]/  }t        j                  |      }d|_        |j                  |       1 ||_        |j                  |       ||z  }_ t        j                         }	|	j                  |      j                  d      }
y)	r  r   rn   r   r   Nr   r   rg  )r   rV   r   r<   r   rW   r   r@   r*   rh  r   ri  )rB   rC   r   r   r   rs   unused_partr   r   rj  rk  s              rH   "testMusicXMLGenerationViaPropertyCz'Test.testMusicXMLGenerationViaPropertyCQ  s    
 .1H
 8KA	IIi("%  "AHHHQK/)J $ ,,.IIaL''0	rJ   c                   t               }t               }t        j                         }t        j                         }d|_        |j                  |       |j                  |       |j                  d|       |j                  t        j                        }| j                  |t        j                         t               }|j                  |       |j                  t        j                        }| j                  |       | j                  ||j                         | j                  ||j                         |j                  t        j                        }| j                  |t        j                         |j                  d      }| j                  t!        |      d       | j                  t!        |j#                         j%                  t&                    d       |j)                         j%                  t&              j+                         }| j                  t!        |      d       | j                  |j+                         t        j                         | j                  t-        |d         d       | j                  |d   t        j                         |j%                  t        j                        }| j                  t!        |      d       y	)
A
        Testing getting clefs from higher-level streams
        rP   r   regularfinalBarliner6   r5   r7   !<music21.meter.TimeSignature 4/4>N)r   r   r<   r   AltoClefpriorityrW   r@   r  r  rV  r  r   r!   r  r   r   lastr[  r   r   r  r   )	rB   ri   rj   r   r  ru  r  	sMeasuresmadeMeasures	            rH   testContextNestedAzTest.testContextNestedAi  s    XXYY[]]_
		"
		"
		!R ##DII.dDMM2 X
		" ##DII.$ 	b"((#b"((# ##DII.dDMM2OOO;	Y+Y^^-@@IJAN'')<<WEKKM[)1-k//14==A[^,.QR 	k!ndii8 ++DII6TA&rJ   c                8   t               }d|_        t        j                         }|j	                  |       t               }d|_        |j	                  |       t        j                         }d|_        |j                  d|       |j                  t
        j                        }| j                  |t
        j                         |j                         }d|_        |j                  t
        j                        }| j                  |t
        j                         y)r  innerStreamouterStreamrP   r   
sInnerFlatN)r   r   r   r<   rW   r   r  r  r@   r  r  rV  r   )rB   sInnerr   sOuterr  ru  r  s          rH   testContextNestedBzTest.testContextNestedB  s     !	YY[b!	f]]_a ''		2dDMM2 ^^%
$
 ++DII6dDMM2rJ   c                   ddl m} t        d      }t        j                         }|j                  |       t        d      }|j                  |       t        j                         }d|_        |j                  d|       |j                  t        j                        }| j                  |t        j                         |j                  dt        j                  g      }| j                  |t        j                         |j                         j                  dt        j                  g      }| j                  |t        j                         | j                  |j!                  |      d       | j#                  t$        j&                  |j                   |j                                |j                  t        j                  |j(                        }| j                  |t        j                         | j                  |j                  t        j                         |j                         j                  t        j                        }| j                  |t        j                         y	)
r  r   )ElementSearchri   )r   rj   rP   r   )getElementMethodN)music21.common.enumsr  r   r   r<   rW   r   r  r  r@   r  r  rV  getElementAtOrBeforer   r   elementOffsetr   r!   SitesExceptionALL)rB   r  ri   r   rj   r  ru  s          rH   testContextNestedCzTest.testContextNestedC  s    	7t_YY[
		"t_
		"]]_
		!R ##DII.dDMM2 &&q499+6dDMM2 zz|00TYYK@dDMM2 	))"-s3%..0@0@"**,O##DII@Q@Q#RdDMM2bggt}}5 zz|--dii8dDMM2rJ   c                H   t        j                         }t        j                         }t               }d|_        t               }d|_        t	               }d|_        |j                  |       |j                  |       |j                  d|       |j                  d|       | j                  |j                  |       t        j                         }d|_        |j                  d|       | j                  |j                  |       |j                  t        j                        }| j                  |t        j                         | j                  |j                  |       |j                  t        j                        }| j                  |t        j                         t        j                         }d|_        |j                  d|       |j!                  t        j                        }| j                  |d   t        j                         |j                  t        j                        }| j                  |t        j                         |j#                         j!                  t        j                        }| j                  |d   t        j                         t%        j&                  |j#                               }	|	j!                  t        j                        }| j                  |d   t        j                         |j#                         j                  t        j                        }| j                  |t        j                         |j#                         }
d|
_        t%        j&                  |
      }d|_        | j)                  |j                  t        j                               |j                  t        j                        }| j                  |t        j                         |
j                  t        j                        }| j                  |t        j                  |       | j+                  ||j,                  j/                                |j1                         }| j                  |d   j                  t        j                         |j1                         }| j                  |d   j                  t        j                         t%        j&                  |      }|j!                  t2              d   j1                         }| j                  |d   j                  t        j                         |j                  dt        j4                                |j!                  t        j                        }| j                  |d   t        j4                         y	)
r  ri   rj   r  r   rP   s1Flat
s1FlatCopyr5   N)r   r<   r
   r   r	   rW   r@   r  r
  r   r  r  r  r  rV  	TenorClefr[  r   rX   rY   r  r   r!   getr  r   BassClef)rB   r   r   ri   rj   r  acru  tenorC
s2FlatCopyr  r  
s1Measures
s2Measuress3copys                  rH   testContextNestedDzTest.testContextNestedD  s    YY[YY[VV	
		"
		"aabmmV,]]_a 	bmmV,##DII.dDMM2bmmV,##DII.dDMM2 !
		!V$$TYY/d1gt~~6 ##DII.dDMM2 zz|..tyy9d1gt~~6 ]]2::<0
,,TYY7d1gt~~6 zz|--dii8dDMM2 	]]6*
$
Z99$))DE++DII6dDMM2''		2dDMM48fbhhlln-__&
 	jm00$--@
 __&
jm00$..A v& ..v6q9FFH
jm00$..A 			!T]]_%$$TYY/d1gt}}5rJ   c                   g ddz  }d}d}t        d      D ]H  }t               }|D ]/  }t        j                  |      }d|_        |j                  |       1 ||_        | j                  |j                  d       |j                          | j                  |j                  |       |j                  d	       |j                  t        j                        j                         }| j                  t        |      d
       | j                  |j                  j                  |       | j                  |d
   j                  |j                  j                         ||z  }K y )Nr   rn   r   r6   r   r   r   Tr  r5   )rV   r   r   r<   r   rW   r   r   r  r  r  r[  r  streamr   r   )	rB   rC   r   r   r  rs   r   r   subs	            rH   testMakeRestsAzTest.testMakeRestsAp  s   -1
 8KA	IIi("%  "AHQ^^Q/&&(Q^^Z8KKK% &&tyy188:CSXq)S\\77D QqT[[#,,*D*DE/)J3 $rJ   c                   t               }t               }t        j                  d      |_        |j                  dt        j                                t               }|j                  dt        j                                | j                  |j                         |j                  d|       |j                  d|       |j                  ddd       | j                  |j                         t        |j                         j                  D cg c]  }|j                  ||j                  f c}      }| j!                  |d       t        |j                         D cg c]  }|j                  ||j                  f c}      }| j!                  |d       t        t#        |j                         j                              }| j!                  |d	       t        |j                         j                  D cg c]  }||j                  f c}      }| j!                  |d
       t%        j&                         }|j)                  |      j+                  d      }y c c}w c c}w c c}w )Nr   r6   r5   r   rn   T)r  fillGapstimeRangeFromBarDurationz[(0.0, <music21.note.Rest quarter>, <music21.duration.Duration 1.0>), (1.0, <music21.note.Note C>, <music21.duration.Duration 1.0>), (2.0, <music21.note.Rest half>, <music21.duration.Duration 2.0>)]z[<music21.note.Rest half>, <music21.note.Note C>, <music21.note.Rest quarter>, <music21.note.Rest quarter>, <music21.note.Note C>, <music21.note.Rest half>]an  [(<music21.note.Rest half>, <music21.duration.Duration 2.0>), (<music21.note.Note C>, <music21.duration.Duration 1.0>), (<music21.note.Rest quarter>, <music21.duration.Duration 1.0>), (<music21.note.Rest quarter>, <music21.duration.Duration 1.0>), (<music21.note.Note C>, <music21.duration.Duration 1.0>), (<music21.note.Rest half>, <music21.duration.Duration 2.0>)]rg  )r   r   r   r;   r   r@   r   r<   r   r   r  r   r   r  r   r   r   r   r*   rh  r   ri  )rB   r   r  r	  r   matchrj  rk  s           rH   testMakeRestsBzTest.testMakeRestsB  s   HY ..u5
		!TYY[!Y
		!TYY[!$	B	B	D4$O$ 

8R8RS8R1ahh1::.8RST_	`
 

E1ahh1::.EF_	` D2234 !W 	X aiik.G.GH.Ga_.GHI[	\ ,,.IIaL''0	9 T F Is    I  I 8I%c                   t               }t               }t        j                  d      |_        |j                  dt        j                                t               }|j                  dt        j                                |j                  |       |j                  |       | j                  |j                  j                  d       | j                  |j                  j                  d       | j                  |j                  j                  d       ||fD ]  }|j                  dd        | j                  |j                  j                  d	       | j                  |j                  j                  d	       | j                  |j                  j                  d
       |j                  d       | j                  |j                  j                  d       y )Nr   r6   r5   r   r   r   Tr  r  r         @r  r  )r
   r   r   r;   r   r@   r   r<   rW   r   r   r   r  )rB   rs   r  r	  r   s        rH   testMakeRestsInMeasureszTest.testMakeRestsInMeasures  sN   FY ..u5
		!TYY[!Y
		!TYY[!		22C822C81137bAKKtKD  	22C822C8 	1137	D!1137rJ   c                ~   t               }t        t        j                  d      d      }t	        t        j                  d            }t	        t        j                  d            }|j                  d|       |j                  d|       |j                  d|       |j                  dd	
      }| j                  t        |j                         j                  t
        j                              d       | j                  t        |j                         j                  t
        j                              d       t        |g      }|j                  dd	
      }| j                  t        |j                         j                  t
        j                              d       | j                  t        |j                         j!                  d      j                  t
        j                              d       | j                  t        |j                         j                  t
        j                              d       y )Nr   r5   r        @rF        @r   FTr  r6   )r
   r   r   r;   r   r   r<   r@   r  r   r   r  r[  r  r   r	   r[  )rB   rs   r   r  r  ru  scs          rH   !testMakeRestsInMeasuresWithVoicesz&Test.testMakeRestsInMeasuresWithVoices  s~   FE''.q94993/0499401	B	B	A{{54{H 	TZZ\<<TYYGH!LT\\^>>tyyIJAN A3Z||ED|ITZZ\<<TYYGH!LTZZ\11!4GG		RSUVWT\\^>>tyyIJANrJ   c                   t        t        j                  d      d      }|j                  dt	        j
                  d             |j                  dt	        j
                  d             |j                  d	       | j                  t        |j                  t        j                              d       | j                  t        |t        j                           d
       y )Nr   r5   r  r   r  rF  r  Tr  r6   )r   r   r;   r@   r   r<   r  r   r   r[  r  rB   r   s     rH   testMakeRestsByMakingVoicesz Test.testMakeRestsByMakingVoices  s    E''.q9	DIIC01	DIID12	T" 	Q11$))<=qAQtyy\*A.rJ   c                   t               }|j                  dt        j                                |j                  dt	        j
                  d             |j                  t        j                  dd             |j                  t        j                  dd             |j                  d       | j                  t        |j                  t                    d	       | j                  |j                  d
      j                  d   j                   d       | j                  |j                  d	      j                  d   j                   d       y )Nr   r/   rd   r   rF  re   Tr  r6   r5   r   r   )r   r@   r   r<  r   r;   rW   r   r<   r  r   r   r[  r   r[  r   r   )rB   sScrs     rH   testMakeMeasuresInPlacezTest.testMakeMeasuresInPlace  s    xAt()Au**512DIId#67DIId#67$'T44W=>Ba..q166<a..q166<rJ   c                   t        j                  d      }t               }|j                  dt	        j
                  d             |j                         j                  |      j                  d      }| j                  t        |j                  t                    d       t               }|j                  dt	        j
                  d             |j                         j                  |      j                  d      }| j                  t        |j                  t                    d       t               }|j                  dt	        j
                  d	             |j                         j                  |      j                  d      }| j                  t        |j                  t                    d
       t               }|j                  dt	        j
                  d             |j                         j                  |      j                  d      }| j                  t        |j                  t                    d       t               }|j                  dt	        j
                  d             |j                         j                  |      j                  d      }| j                  t        |j                  t                    d       y)z
        Testing making measures of various sizes with a supplied single element meter stream.
        This illustrates an approach to partitioning elements by various sized windows.
        r  r   rf   Fr     rL  rD  r/   r+  z12/4rn   z48/4r5   N)r   r   r   r@   r   r;   r   r  r  r   r   r[  r   )rB   sBachmeterStreamsPartitioneds       rH   testMakeMeasuresMeterStreamz Test.testMakeMeasuresMeterStream
	  s/   
 ./h1e11%89}}33K@II J \<<WEFKh1e11%89}}33K@II J \<<WEFKh1e11%89}}33K@II J \<<WEFKh1e11&9:}}33K@II J \<<WEFJh1e11&9:}}33K@II J \<<WEFJrJ   c                   t               }|j                  t        j                  d      d       |j	                  dt        j                  d             |j                         }| j                  t        |j                  t              j                         j                        d       |j                  dd	      }|j                  t              D cg c]  }t        |j                         }}| j                  |g d
       t        j                  d      }t        j                  d      }|j                  ||	      }|j                  t              D cg c]  }t        |j                         }}| j                  |g d       |j                  dd	      }	|	j                  t              D cg c]  }t        |j                         }}| j                  |g d       yc c}w c c}w c c}w )zE
        Test makeMeasures with optional barline parameters.
        r   rF  r{   r   z5/8 <music21.bar.Barline type=final>dasheddouble)innerBarliner  )!<music21.bar.Barline type=dashed>r  r  !<music21.bar.Barline type=double>noneshort)<music21.bar.Barline type=none>r	  r	  z <music21.bar.Barline type=short>Nr  r  r  r  )r   r   r   r<   r@   r   r;   r  r   r   r[  r   r  rightBarliner   Barline)
rB   r   barred1barred2r   r  bar1bar2barred3barred4s
             rH   testMakeMeasuresWithBarlinesz!Test.testMakeMeasuresWithBarlines3	  s    H	tyys3R8	E''./ .."**7388:GGH.	0
 ..hX.N++G464 *+Q^^$4 	 6 !F 	G {{6"{{7#..d.F ++G464 *+Q^^$4 	 6 !E 	F ..d.F++G464 *+Q^^$4 	 6 @A1666s   G+G08G5c                   t               }|j                  t        j                  d             t	        j
                  d      }|j                  d|       |j                  d       | j                  t        |d         d       y )Nr/   FREEZEr7   Tr  
Expressionr5   )
r   rW   r   r;   r   TextExpressionr@   r  r   r   )rB   r   r|  s      rH   %testMakeMeasuresLastElementNoDurationz*Test.testMakeMeasuresLastElementNoDuration]	  se    H	$$U+,((2	C	t$Q|_-q1rJ   c                |   t               }t        j                  d      }t        j                  d      }t        j                  d      }|j                  d|       |j                  d|       |j                  d|       | j	                  t        |      d       | j	                  |j                  |       |j                  |       | j	                  t        |      d       | j	                  |j                  d	       d
}| j                  t        |      5  |j                  d       d	d	d	       y	# 1 sw Y   y	xY w)z9
        Test removing components from a Stream.
        ro   r   rC   r   ry   r3   r7   r6   Nz9clef.TrebleClef is not a Music21Object; got <class 'str'>zclef.TrebleClef)
r   r   r<   r@   r   r   r
  removeassertRaisesRegex	TypeError)rB   r   r   r   r   expecteds         rH   
testRemovezTest.testRemovee	  s     HYYs^YYt_YYs^	B	R	BQ#*	Q#-N##Ix8HH&' 988s   D22D;c                   t               }|j                  t        j                         d       |j                  t	        j
                         d       |j                  t        j                         d       | j                  t        |      d       |j                  d       | j                  t        |      d       | j                  t        |j                        d       |j                  t        j                         | j                  t        |      d       | j                  t        |j                        d       |j                  dg       | j                  t        |j                        d       y )Nr6   r   r  rn   r   r   )r   r   r   r  r   r<   r<  r   r   removeByClassr   r  rB   r   s     rH   testRemoveByClasszTest.testRemoveByClass	  s    H	t}}*	tyy{A&	t(!,Q#	
#Q#QWWq)			"Q#QWWq)	)*QWWq)rJ   c                   t               }t        j                  d      }t        j                  d      }t        j                  d      }t        j                  d      }|j                  d|       |j                  d|       | j	                  t        |      d       |j                  ||       | j	                  |d   |d   g||g       |j                  ||       | j	                  |d   |d   g||g       |j                  ||       | j	                  |d   |d   g||g       | d	| }| j                  t        |      5  |j                  ||       d
d
d
       y
# 1 sw Y   y
xY w)z:
        Test replacing components from a Stream.
        ro   r   rC   rg   r   r3   r6   r5   z already in N)	r   r   r<   r@   r   r   r_  r  r   )rB   r   r   r   r   r   r  s          rH   testReplacezTest.testReplace	  s1    HYYs^YYt_YYs^YYs^	B	BQ#			"b!A$!Bx0			"b!A$!Bx0			"b!A$!Bx0TaS)##OX>IIb" ?>>s   E!!E*c                j   t        j                  d      }|j                  j                         }|j	                         j                  t        j                        j                         }| j                  |t        j                         t        j                         }|j	                         j                  ||d       |j                  j                         j	                         j                  t        j                        j                         }| j                  |t        j                         y )Nr  T
allDerived)r   r   r   r  r   r[  r   r  rV  r<  r  r_  )rB   r  partSopranor  r  cTests         rH   testReplaceA1zTest.testReplaceA1	  s    ./kk'')  "55dii@FFHb$//2 ]]_%%b"%> !!#++-@@KQQSeT]]3rJ   c                T   t        j                  d      }t        j                  d      }t               }t        j                  |      }t        j                  |      }t               }|j                  d|       |j                  d|       |j                  d|       |j                  d|       |j                  ||d       | j                  |d   |       | j                  |d   j                  |      d       | j                  |d   |       | j                  |d   j                  |      d       | j                  |d   |       | j                  |d   j                  |      d       | j                  |d   |       | j                  |d   j                  |      d       y )	Nro   r   r   ry   r{   r   Tr&  )
r   r<   r   rX   rY   r@   r_  r  r   r  )rB   r   r   s0ri   rj   r  s          rH   testReplaceBzTest.testReplaceB	  s\   YYs^YYt_X]]2]]2X
		!R
		"b
		"b
		"b


2rd
+ 	beR A..r2A6 	beR A..r2B7 	beR A..r2B7 	beR A..r2B7rJ   c                   t        j                  d      j                  d   j                  dd      }d|_        |j                         }t        |j                  j                               }| j                  |d   |       |j                  t        j                        j                         }| j                  |j                  d       t        j                  d      }t!               }|j#                  d|       |j%                  ||d	       |j                  t        j                        j                         }| j                  ||       | j                  |j                  d       |j'                         j                  t        j                        j                         }| j                  ||       | j                  |j                  d       | j                  |d   |       y )
Nciconia/quod_jactaturr   r5   r6   measureExcerptrP   Tr&  )r   r   r   r  r   r   r   
derivationchainr  r[  r   r=  r  r   sharpsr   r@   r_  r   )	rB   qjqj_flatdck1k3flats
mUnrelatedkWhichkWhich2s	            rH   testReplaceDerivedzTest.testReplaceDerived	  sr   \\1288;DDQJ **,'$$**,-beR ''(8(89??AB'""2& Y
!R  	G5++C,<,<=CCEfg&+**,11#2B2BCIIKgw', 	jmR(rJ   c                H   t        j                         }t               }|j                  |       t               }|j                  |       |j	                         }t        j                  |      }t        j                  |j	                               }|j                         }y N)r   r<   r   r@   r   rX   rY   r  )rB   r   ri   rj   s2Flat	unused_s3r  unused_s3Measuress           rH   testDoubleStreamPlacementzTest.testDoubleStreamPlacement	  sq    YY[X
		"
 X
		"
  MM&)	]]2::<(OO-rJ   c                "   t               }dD ].  }t        j                         }||_        |j	                  |       0 |j                         }| j                  |j                  d       | j                  |j                  d       t               }dD ].  }t        j                         }||_        |j	                  |       0 |j                         }| j                  |j                  d       | j                  |j                  d       t               }dD ].  }t        j                         }||_        |j	                  |       0 |j                         }| j                  |j                  d       | j                  |j                  d       y	)
zH
        Get a time signature based on components in a measure.
        )r6   r7   r6   r  rn   r   r   r   r   )r   r   r   N)	r   r   r<   r   rW   bestTimeSignaturer   r  denominator)rB   r   qlr   rD   s        rH   testBestTimeSignaturezTest.testBestTimeSignature
  s6    IB		A AOHHQK    "q)+IB		A AOHHQK    "q)+IB		A AOHHQK    "q),rJ   c                   t               }t        j                  d      }t        j                  d      }|j                  |       |j                  |       |j	                  t        j                        }| j                  |d   |       | j                  |d   |       t        j                  d      }t               }t        j                         }d|_	        |j                  |       ||_
        t               }t        j                         }d|_	        |j                  |       t               }|j                  |       |j                  |       |j	                  t        j                        }| j                  |d   |       |j                         j	                  t        j                        }| j                  |d   |       |j                  t        j                        }| j                  ||       y)7
        Searching contexts for key signatures
        r5   r   r7   rn   N)r   r   r=  rW   r[  r   r   r   r<   r   keySignaturer  r   r  )	rB   r   ks1ks2ru  r  r   r	  r   s	            rH   testGetKeySignatureszTest.testGetKeySignatures2
  s    Hq!r"		##C$4$45a#&a#& q!YYY[
		"YYY[
		"H		 $$S%5%56d1gs# yy{--c.>.>?d1gs# ##C$4$45dC rJ   c                ^   t        j                  d      }t        j                  d      }t               }t        j                         }d|_        |j                  |       ||_        t               }t        j                         }d|_        |j                  |       t               }t        j                         }d|_        |j                  |       ||_        t               }	|	j                  |       |	j                  |       |	j                  |       |j                  t         j                        }
| j                  |
d   |       |j                  t         j                        }
| j                  |
|       |j                  t         j                        }
| j                  |
|       y)rK  r5   r7   rn   r   N)r   r=  r   r   r<   r   rW   rM  r   r[  r  r  )rB   rN  ks3r  r   r	  r   m3r   r   ru  s              rH   !testGetKeySignaturesThreeMeasuresz&Test.testGetKeySignaturesThreeMeasures]
  s?   
 q!q!YYY[
		"YYY[
		"YYY[
		"H			 $$S%5%56d1gs# ##C$4$45dC  ##C$4$45dC rJ   c                <   t               }t        j                  d      }t        j                  d      }t        j                         }t	        j
                  g d      }t        j                  d      }|j                  |       |j                  |       |j                  |       |j                  |       |j                  |       |j                  d       | j                  |j                  j                  j                         | j                  |j                  d   j                  j                         | j                  |j                  d   j                  j                         | j                  |j                  j                  d       t               }t        j                  d      }t        j                  d	      }t        j                         }t	        j
                  g d      }|j                  |       |j                  |       |j                  |       |j                  |       |j                  d
d       | j                  |j                  d   j                  d       | j                  |j                  d   j                  d       y)z1
        Test accidental display setting
        rq   a4)a#2rV  a5Tr  r5   r6   NrC   F)cautionaryPitchClassr  )r   r   r<   r  r   r  rW   makeAccidentalsr   r    r\   displayStatusrN  r  r   )rB   r   r   r   r  r  r   s          rH   testMakeAccidentalsAzTest.testMakeAccidentalsA
  s    HYYt_YYt_YY[[[,-YYt_						$'++99:

100>>?

100>>? 	"((--t4HYYt_YYs^YY[[[,-					udC 	A1148A1148rJ   c                   t        j                  d      }|j                  d   j                  t              d   }|j                  t
        j                        }| j                  t        |d   j                        d       | j                  t        |d   j                  d   j                  j                        d       t        j                  d      }|j                  d   j                  t              d   }|j                  t
        j                        }| j                  t        |d   j                        d	       | j                  t        |d   j                  d   j                        d
       y )Nzmonteverdi/madrigal.5.3.rntxtr   !   r5   zO(<music21.pitch.Pitch B-4>, <music21.pitch.Pitch D5>, <music21.pitch.Pitch F5>)Falsezmonteverdi/madrigal.5.4.rntxtI   zN(<music21.pitch.Pitch C5>, <music21.pitch.Pitch E5>, <music21.pitch.Pitch G5>)r  )r   r   r   r[  r   r   r  r   r   rN  r\   r[  )rB   r   m34rg   m74s        rH   testMakeAccidentalsBzTest.testMakeAccidentalsB
  s    LL89ggaj++G4R8""5;;/QqT\\* -T 	U 	QqT\\!_77EEFPLL89ggaj++G4R8""5;;/QqT\\*:	; 	QqT\\!_778&ArJ   c                `   t               }|j                  t        j                  d      d       |j                  t        j                  d      d       t               }|j                  t        j                  d      d       t	               }|j                  ||g       | j                  t        |j                         j                        d       | j                  t        |j                         j                  dd        d       |j                         j                  dd  D cg c]!  }t        |j                  j                        # }}| j                  |dgdz         |j                         j                  dd  D cg c]"  }|j                  j                  j                  $ }}| j                  |g d       |j                  d	
       |j                         j                  dd  D cg c]"  }|j                  j                  j                  $ }}| j                  |g d       t	               }|j                  dt!        j"                  d             t        j                  dd      }t        j                  dd      }	|j                  |d       |j                  |	d       |j%                         }|j                         j                  D cg c]"  }|j                  j                  j                  $ }}| j                  |g d       y c c}w c c}w c c}w c c}w )Nf4r6   f#4rn   r   r   sharp)NNNNNNTr  )TFTFFFr   rf   zE-4UUUUUU?rF  F#4UUUUUU?ry   r  )r5   r   r   r   r   r   r5   r   r   r   r5   r5   r   r   r5   r   r   )r   r   r   r<   r
   rW   r   r   r   r   r   r    r\   r[  rZ  r@   r   r;   r  )
rB   r  r	  exr   accdisplayrs   tuplet1tuplet2s
             rH   testMakeAccidentalsCzTest.testMakeAccidentalsC
  sx    Y
		$+
		%(!,Y
		%(!,V
		2r(RZZ\//0!4RZZ\//34a8 13

0B0B120FG0F1s177%%&0FGwi!m,=?ZZ\=O=OPQPR=ST=S177%%33=ST"FG
 	4(=?ZZ\=O=OPQPR=ST=S177%%33=ST"JKF	E''./))E7))E7	w#	w"^^ >@ZZ\=O=OP=O177%%33=OP #, 	-1 HT U Qs   )&L'L!4'L&'L+c                X   t               }t               }|j                  t        j                  d             |j                  t        j                  dd             |j                  t        j                  dd             d|_        |j                  |       |j                  d       |j                  D cg c]  }|j                  j                   }}| j                  |ddg       |j                  d	      }| j                  t        |j                        d
       y c c}w )Nr   r   r   r1   finalTr  Fr5   r  )r
   r   rW   r   r;   r   r<   r  r  rN  r\   r[  r   r[  r   )rB   r   r  rs   r  r   s         rH   testMakeAccidentalsDzTest.testMakeAccidentalsD
  s    VY
		%%%e,-
		$))Dv./
		$))Dv./!
		"
%57ZZ@Z++Z@u.JJqMQ^^,.PQ As   =D'c                ~   t        j                  dd      }t        j                  dd      }t        |      }t        |      }t        ||g      }t	        |      }|j                  d       | j                  |t         j                     j                         j                  j                  j                  d       y)z
        Making accidentals on a score having a part with measures
        should still reiterate accidentals measure by measure.
        r   r  r1   Tr  N)r   r<   r   r
   r	   rZ  r  r  r    r\   r[  )rB   r   r   r  r	  rs   r   s          rH   testMakeAccidentalsInScorezTest.testMakeAccidentalsInScore   s    
 YYt'*YYt'*R[R["bN!H	$'a		l'')//::HH$OrJ   c           	        g d}g d}g d}t               }|||fD ]>  }t        j                  d      t        j                  d      t        j                  d      t        j                  d      t        j                  d      t        j                  d	      fD ]  }t               }t	        j
                  d
      |_        ||_        |dz  D ]T  }t        j                  |      }	d|	_
        |	j                  |	j                  j                         |j                  |	       V |j                  d       |j!                  d       |j                  |        A y )N)r  d4r  re  r  rV  r  c5)rg   rh   ze-r   ro   za-zb-rx  )rp   zd#ze#r   r   rq   zb#c#5r   r6   rn   r  rP   r1  r   r   Tr  )r   r   r=  r   r   r;   r   rM  r   r<   r   addLyricr    r   rW   r   rZ  )
rB   scale1scale2scale3r   scaler?  r   rs   r   s
             rH   %testMakeAccidentalsWithKeysInMeasuresz*Test.testMakeAccidentalsWithKeysInMeasures  s   A=BHff-E''*C,<,<Q,?''*C,<,<Q,?AQAQRTAU''+- I"'"5"5e"<!#A		!A&*AOJJqww||,HHQK	 #
 D)!!$!/- .rJ   c           
         t        j                  dd      }|j                  dd       |j                         j                  }g d}t        t        ||            D ]_  \  }\  }}| j                  |j                  j                  j                  || d|j                  j                  j                   d|        a t        j                  d	d      }|j                  dd       |j                         j                  }g d
}t        t        ||            D ]_  \  }\  }}| j                  |j                  j                  j                  || d|j                  j                  j                   d|        a y)z[
        tests to make sure that Accidental display status is correct after a tie.
        zAtinynotation: 4/4 c#'2 b-2~ b-8 c#'8~ c#'8 b-8 c#'8 b-8~ b-8~ b-8Fr  T)r  cautionaryNotImmediateRepeat)
TTFTFTFFFFz	 failed, z != zEtinynotation: 4/4 c#'2 b-2~ b-8 b-8 c#'8~ c#'8 b-8 c#'8 b-8~ b-8~ b-8)TTFTTFFFFFFN)r   r   r  r   r   r  zipr   r    r\   r[  )rB   bmallNotesdsra   dsir^  s          rH   testMakeAccidentalsTieszTest.testMakeAccidentalsTies'  sT    __O  	5I::<%%O"+CH,=">AXX^^66DD  !s)HNN,E,E,S,S+TTXY\X]^` #? __S  	5I::<%%V"+CH,=">AXX^^66DD  !s)HNN,E,E,S,S+TTXY\X]^` #?rJ   c                \   t        j                  d      }d|j                  j                  _        t        |      }| j                  |j                  j                  j                         |j                  d       | j                  |j                  j                  j                  d       y )ND#neverTr  F)
r   r<   r    r\   displayTyper   r  r[  rZ  r  rB   r   r   s      rH   &testMakeAccidentalsRespectsDisplayTypez+Test.testMakeAccidentalsRespectsDisplayTypeD  sw    IIdO)0&1I!'',,::;	$'agg((66>rJ   c                   t        j                  d      }t        |      }| j                  t	        d |D                     |j                  d       | j                  t        d |D                     t        j                  d      }t        |      }| j                  |d   j                  j                         |j                  d       | j                  |d   j                  j                  j                         |j                  \  }}d |_        d |_
        d |_        d |j                  _        |j                  d       | j                  t        d |D                     t        j                  d	      }t        t        j                  d
      |g      }|j                  d       | j                  t        d |D                     y )NzF# A# C#c              3  \   K   | ]$  }|j                   j                  j                   & y wr?  r    r\   r[  .0r   s     rH   	<genexpr>z2Test.testMakeAccidentalsOnChord.<locals>.<genexpr>Q  s!     Iq!QWW//==q   *,Tr  c              3  \   K   | ]$  }|j                   j                  j                   & y wr?  r  r  s     rH   r  z2Test.testMakeAccidentalsOnChord.<locals>.<genexpr>S  s!     HaAGG..<<ar  zF4 F#5r   c              3  \   K   | ]$  }|j                   j                  j                   & y wr?  r  r  s     rH   r  z2Test.testMakeAccidentalsOnChord.<locals>.<genexpr>c  s#     WFVAGG..<<FVr  zF#4 F#5r5   c              3  `   K   | ]&  }|j                   j                  j                  d u  ( yw)FNr  r  s     rH   r  z2Test.testMakeAccidentalsOnChord.<locals>.<genexpr>i  s&     \|!AGG..<<E|s   ,.)r   r  r   r   anyrZ  r   allr  r    r\   r[  rN  r=   r   r=  )	rB   rg   r   augmented_octaverj   lowhightwo_f_sharpsr  s	            rH   testMakeAccidentalsOnChordzTest.testMakeAccidentalsOnChordN  sv   KK
#1IIqIIJ	$'HaHHI ;;x0$%*1-33>>?
4((+11<<JJK %,,	T
(,%
4(WFVWWX {{9-S%%a(,78
4(\|\\]rJ   c                j   t        j                  d      }|j                  d      j                  dt	        j
                  d             |j                  d       | j                  |j                  d      j                  j                         j                  j                  j                  d       y )	Ntinynotation: 4/4 f#1~ f#1r5   r   r4  Tr  r6   F)r   r   r[  r@   r   r=  r  r  r   r  r    r\   r[  rB   rs   s     rH   testMakeNotationTiesKeylessz Test.testMakeNotationTiesKeylessk  sz    OO89			!As//q9:	t$aiil((..066AAOOQVWrJ   c                   t        j                  d      }|j                  d      j                  dt	        j
                  d             |j                         }| j                  |j                  d      j                  j                         j                  j                  j                  d       t        j                  d      }|j                  d      j                  dt	        j
                  d             |j                         }| j                  |j                  d      j                  j                         j                  j                  j                  d       t        j                  d	      }|j                  d      j                  dt	        j
                  d             |j                         }| j                  |j                  d      j                  j                         j                  j                  j                  d       t        j                  d      }|j                  d      j                  dt	        j
                  d             |j                         }| j                  |j                  d      j                  j                         j                  j                  j                  d       |j                         j                  D ]	  }d |_         |j                         }| j                  |j                  d      j                  j                         j                  j                  j                  d       y )
Nr  r6   r   r5   r  FrP   Tztinynotation: 4/4 b1~ b1)r   r   r[  r@   r   r=  r  r  r   r  r    r\   r[  r   r&   )rB   rs   mader   made_no_tiess        rH   testMakeNotationTiesKeyChangez"Test.testMakeNotationTiesKeyChanges  s@   OO89			!As//q9:~~dll1o++11399DDRRTYZOO89			!As//r:;~~dll1o++11399DDRRTXYOO67			!As//r:;~~dll1o++11399DDRRTXYOO89			!As//r:;~~dll1o++11399DDRRTYZ ""AAE #~~'l**1-3399;AALLZZ\`arJ   c                   t               }t        j                  d      }|j                  |       |j                  t	        j
                  d             |j                  t	        j
                  d             |j                  D ]2  }| j                  |j                  j                  j                  d        4 |j                  d       |j                  D ]1  }| j                  |j                  j                  j                         3 y )Nr1  zB-2B-1Tr  )r   r   r=  rW   r   r<   r   r   r    r\   r[  rZ  r   )rB   r   kr   s       rH   testMakeAccidentalsOctaveKSz Test.testMakeAccidentalsOctaveKS  s    HR 		5!"	5!"AQWW//==tD  	
$'AQWW//==> rJ   c           
          fd}t        j                         }d|_        t               }|j	                  |d        ||dg d        ||dg d        ||dg d        ||d	g d
        ||dg d       t        j                         }d|_        t               }|j                  |t        t        dd                    ||dg d        ||dg d        ||dg d        ||dg d        ||d	g d        ||dg d       t               }t        j                         }d|_        |j                  |t        t        ddd                   t        j                         }d|_        |j                  |t        t        ddd                    ||dg d        ||d	g d        ||dg d       t               }t        j                         }d|_        |j                  |t        t        ddd                   t        j                         }d|_        |j                  |t        t        ddd                    ||dg d        ||d	g d        ||dg d         ||d!g d"       y )#Nc                    | D cg c]  }|j                    }}|j                          | j                  |d      }|D cg c]  }|j                    }}|j                          j                  |d t	        |       |       y c c}w c c}w NFr  )r   sortscaleOffsetsr   r   )s_innerscalarr  r   oListSrcsNew	oListPostrB   s          rH   procComparez/Test.testScaleOffsetsBasic.<locals>.procCompare  s    *12'Q'H2MMO'''>D+/04a4I0NN Y{E
3U; 3 1s   BBr6   ry   r   r   r  rn   r   r  r  r  r7   r         @r        2@r   r   r   r   r   r   r   r   r   r   r5   r  r   r  e   f   g   r  r  h   j   r  r  l   p   r   r       `Y@     Y@g      Z@r        Y@     @Y@r  r  g     Y@r  g     0Y@r   r   r   r   r   r   r  r  r   r   r   r   r   r  r   r   r  r  r        ,@   r  r  r  r  g      Z@     Z@g     Z@r  r  r       Y@r  g     Y@r  r  r  g      [@g      \@g     \@r   r  r  g     ]@g      _@g      a@g     a@)r   r<   r   r   r   r>   r   rV   )rB   r  r   r   r   r   s   `     rH   testScaleOffsetsBasiczTest.testScaleOffsetsBasic  s   		< IIKH	q" 	Aq/*Aq01Aq01As01At12 IIKH	q$uS#/0Aq./Aq./Aq./As67As67At9: HYY[	q$uQA/0YY[	q$uQA/0Aq89As:;Aq:; HYY[	q$uS#q123YY[	q$uS#q123AqDEAsFGAqDEAqDErJ   c                ~      fd} |dg d        |dg d        |dg d        |dg d	        |d
g d       y )Nc                   t        j                         }d|_        t               }|j	                  |d       |D cg c]  }|j
                   }}|j                          |j                  | d       |D cg c]  }|j
                   }}|j                          j                  |d t        |       |       y c c}w c c}w )Nr6   ry   Tr  )
r   r<   r   r   r   r   r  r  r   r   r  r  r   r   r   r  r  rB   s          rH   r  z7Test.testScaleOffsetsBasicInPlaceA.<locals>.procCompare  s    		AAOANN1b!*+,!Q!H,MMONN64N0+,-1a1I-NN Y{E
3U; - .s   B=9Cr6   r  rn   r  r7   r  r   r  r   r  r   rB   r  s   ` rH   testScaleOffsetsBasicInPlaceAz"Test.testScaleOffsetsBasicInPlaceA  s@    	<$ 	A'A-.A-.C-.D./rJ   c                      fd} |dg d        |dg d        |dg d        |dg d	        |d
g d        |dg d       y )Nc           	        t        j                         }d|_        t               }|j	                  |t        t        dd                   |D cg c]  }|j                   }}|j                          |j                  | d       |D cg c]  }|j                   }}|j                          j                  |d t        |       |       y c c}w c c}w )Nr5   r  r   Tr  )r   r<   r   r   r>   r   rV   r   r  r  r   r   r  s          rH   r  z7Test.testScaleOffsetsBasicInPlaceB.<locals>.procCompare  s    		AAOANN1d5c?34*+,!Q!H,MMONN64N0+,-1a1I-NN Y{E
3U; - .s   CCr5   r  r6   r  rn   r  r   r  r   r  r   r  r   r  s   ` rH   testScaleOffsetsBasicInPlaceBz"Test.testScaleOffsetsBasicInPlaceB  sL    	<  	A+,A+,A+,C34C34D67rJ   c                R      fd} |dg d        |dg d        |dg d       y )Nc           
     8   t               }t        j                         }d|_        |j	                  |t        t        ddd                   t        j                         }d|_        |j	                  |t        t        ddd                   |D cg c]  }|j                   }}|j                          |j                  | d       |D cg c]  }|j                   }}|j                          j                  |d t        |       |       y c c}w c c}w )Nr5   r   r   r7   r6   Tr  r   r   r<   r   r>   r   rV   r   r  r  r   r   	r  r  r   r   r   r   r  r  rB   s	           rH   r  z7Test.testScaleOffsetsBasicInPlaceC.<locals>.procCompare  s    AB BNN2tE!RO45B BNN2tE!RO45*+,!Q!H,MMONN64N0+,-1a1I-NN Y{E
3U; - .   DDr5   r  r   r  r6   r  r   r  s   ` rH   testScaleOffsetsBasicInPlaceCz"Test.testScaleOffsetsBasicInPlaceC  s+    	<( 	A56C78A78rJ   c                h      fd} |dg d        |dg d        |dg d        |dg d	       y )
Nc           
     8   t               }t        j                         }d|_        |j	                  |t        t        ddd                   t        j                         }d|_        |j	                  |t        t        ddd                   |D cg c]  }|j                   }}|j                          |j                  | d       |D cg c]  }|j                   }}|j                          j                  |d t        |       |       y c c}w c c}w )	Nr5   r  r  r7   r6   r  Tr  r  r  s	           rH   r  z7Test.testScaleOffsetsBasicInPlaceD.<locals>.procCompare,  s    AB BNN2tE#sA$678B BNN2tE#sA$678*+,!Q!H,MMONN64N0+,-1a1I-NN Y{E
3U; - .r  r5   r  r   r  r6   r  r   r  r   r  s   ` rH   testScaleOffsetsBasicInPlaceDz"Test.testScaleOffsetsBasicInPlaceD+  s6    	<( 	AABCCDAABAABrJ   c                N    fd fd}t        j                         }d|_        t               }|j	                  |d       t        j                         }d|_        t               }|j	                  |d       |j                  |        j                   |      dgdgdgd	gd
dgdgdgdgggg        ||dddgdgd
gdgddgdgdgdgggg        ||dddgd
gdgdgddgdgdgd	gggg        ||dddgdgdgdgddgdgdgdgggg       t        j                         }d|_        t               }|j                  |g d       t        j                         }d|_        t               }|j                  |g d        j                  |j                  d       |j                  |        j                  |j                  d       |j                  t        j                  |             |j                  t        j                  |              j                   |      dgdgdgdgd d!gd"gd#gd$gggd%d!gd"gd#gd$gggd&d!gd"gd#gd$gggg        ||dddgd gd'gdgd(d!gd#gd)gd*gggd+d!gd#gd)gd*gggd,d!gd#gd)gd*gggg        ||dd dgd gd'gdgd(d-gd.gd/gd0gggd+d-gd.gd/gd0gggd,d-gd.gd/gd0gggg        ||dddgd1gd2gd3gdd!gd4gd5gd6gggd7d!gd4gd5gd6gggd8d!gd4gd5gd6gggg        ||dd dgd1gd2gd3gddgd9gd:gd;gggd7dgd9gd:gd;gggd8dgd9gd:gd;gggg       y )<Nc                    g }| D ]S  }g }|j                  |j                         |j                  r|j                   |             |j                  |       U |S r?  )rW   r   isStream)r   ru  r   r  scaleOffsetMaps       rH   r  z3Test.testScaleOffsetsNested.<locals>.scaleOffsetMapF  sR    D

188$::JJ~a01C   KrJ   c                     |       }|j                          | j                  ||d      } |      }|j                          j                  |d t        |       |       y )NF)anchorZeroRecurser  )r  r  r   r   )	r   r  r  r  r  r  r  r  rB   s	          rH   r  z0Test.testScaleOffsetsNested.<locals>.procCompareQ  sd    %a(HMMO>>&4E*/ " 1D 't,INN Y{E
3U;rJ   r6   rn   r   r   r   r   r  r  r   r   lowestr  r  r   r  r  r   r         ?r5   )ry   r+  r,  r-        #@)r}        @D@rF       D@3   E   r	  r        .@      1@r  r  r       D@r  g     @Q@g      ^@r         :@      E@g     E@g      `@g     l@g      T@g     @T@g     T@g     T@r       &@     '@g     D@g      D@g     0D@g     8@     B@g     @$@g     $@g     $@)r   r<   r   r   r   rW   r   r>   r@  rX   rY   )rB   r  r   ri   r   rj   r  s   `     @rH   testScaleOffsetsNestedzTest.testScaleOffsetsNestedE  sa   			< YY[X
AYY[X
A
		" 	+%#u#use <=?	@ 	B8USEC54&cUSEC53%89;	< 	B8USED6D6cUSEC53%89;	< 	BhUSEC53%SEE7TFUG<=?	@
 YY[X
,-YY[X
01,
		"5
		$--#$
		$--#$ 	+&4&4&4&4&4&4&4&!AB4&4&4&4&!AB D6D6D6D6"BCE	 	B8VdVdVdVdVdVdVdV<=tftftftf=>tftftftf=>@	 	B4VdVdVdVdVdVdVdV<=tftftftf=>tftftftf=>@	 	BhVdVeWugdVfXwABtfvh&BCdVfXwABD	 	BdVdVeWugdVfXwABtfvh&BCdVfXwABD	rJ   c                     fd}t        j                         }d|_        t               }|j	                  |t        t        d                   |j                  dd      } j                  |D cg c]  }|j                  j                   c}g d        j                  |D cg c]  }|j                  j                   c}g d        ||dg d	        ||d
g d       t               }dD ]/  }t        j                  d      }||_        |j                  |       1  ||dg d        ||dg d        ||dg d       yc c}w c c}w )z?
        Scale some durations, independent of offsets.
        c                    | j                  |d      }|D cg c]  }|j                   }}j                  |d t        |       |       y c c}w r  )scaleDurationsr   r   r   )r   r  r  
sNew_innerr   r  rB   s         rH   r  z1Test.testScaleDurationsBasic.<locals>.procCompare  sP    ))&%)@J2<=*Q*I=Y{E
3U; >s   Ar   r   r6   Fr  )r   r   r   r   r   r   )r   r   r   r   r   r   )r   r   r   r7   )r   r   r   r   r   r6   r7   r   r   r   ro   r   r  r   r   r   r   r   r   )r   r  r   r        ?r  r   rn   )r   r  r   r  r   r   r   N)r   r<   r   r   r>   r   rV   r  r   r   rW   )rB   r  r   ri   r  r   rH  r   s   `       rH   testScaleDurationsBasiczTest.testScaleDurationsBasic  s$   
	<
 YY[X
DqN+   E 2B?Bq!**22B?A_`DADq!**22DACab 	B/0B?+ X3B		#A AOIIaL 4
 	BGHBNOB;<! @As   2E
(Ec                      fd}t               }dD ]/  }t        j                  d      }||_        |j	                  |       1  ||dg dg d        ||dg dg d	        ||d
g dg d       y )Nc                   | j                  |d      }|D cg c]  }|j                   }}|D cg c]  }|j                   }}	j                  |d t	        |       |       	j                  |d t	        |       |       	j                  |d   |j
                         	j                  |d   |d   z   |j                         |j                         }y c c}w c c}w )NFr  rP   )augmentOrDiminishr   r   r   r   r?  r@  r  )
r   r  matchOffsetmatchDurationr  r   r  
qlListPostunused_postrB   s
            rH   r  z4Test.testAugmentOrDiminishBasic.<locals>.procCompare  s     &&vu&=D+/04a4I03784a!//4J8Y'8K(89;GZ(;]);<mL [_d.@.@A[_}R/@@!--/ ++-K 18s
   CCr  ro   r   )r   r   r   r   r  g      @r  r  r   )r   r  r   r        %@g     %@r  )r        @r         @r  r  r  r7   )r   r   r  r        5@g     5@     6@)r   r  r   r)  r  r  r   )r   r   r<   r   rW   )rB   r  ri   rH  r   s   `    rH   testAugmentOrDiminishBasiczTest.testAugmentOrDiminishBasic  sx    	.* X3B		#A AOIIaL 4 	B;>	@ 	B>>	@ 	B<5	7rJ   c                   t        j                  d      }|j                  j                         j	                         j
                  dd }t        |      }| j                  |j                  d       | j                  |j                  d       |j                  dd      }| j                  |j
                  d   j                  d	       | j                  |j
                  d
   j                  d       | j                  |j                  d       | j                  |j                  d       |j                  dd       | j                  |j
                  d
   j                  |      d       | j                  |j
                  d
   j                  d       | j                  |j                  d       | j                  |j                  d       y)zU
        Need to make sure that highest offset and time are properly updated
        r  r   r   r  r  r6   Fr  r   r5   r   g      S@g      U@TN)r   r   r   r  r   r  r
   r   r?  r@  r  r   r  )rB   r{  foundrk  newExs        rH   !testAugmentOrDiminishHighestTimesz&Test.testAugmentOrDiminishHighestTimes	  sw    ll,-		!))+99!B?%[))40. $$Q$6,,Q/66<,,Q/66<,,d3**D1 	Q-))!,<<R@#F))!,33S9))40.rJ   c                   t        j                  d      }|j                  j                         j	                         j
                  dd }t        |      }t               }dD ]G  }t               }|j                  |d      D ]  }|j                  |        |j                  d|       I t        j                         }|j                  |      j                  d      }	t        j                  d      }|j                  d   j	                         j
                  j                         }t               }d	D ]'  }|j                  |d      }|j                  d|       ) |j                  |      j                  d      }	y
)zE
        Extract phrases from the corpus and use for testing
        r  r   r   )r   r   r6   r   Fr  rg  zbach/bwv323.xml)r5   r6   r   r   N)r   r   r   r  r   r  r
   r	   r  rW   r@   r*   rh  ri  r  )
rB   r{  r  rk  r   r  partr   rj  rk  s
             rH   testAugmentOrDiminishCorpusz Test.testAugmentOrDiminishCorpus%  s>   
 ll,- 		!))+99!B?%[G)F6D ))&%)@A AHHQ * ,,.IIaL''0	 ll,-YYq\!!#1188:G&F'''>DHHQ ' IIaL''0	rJ   c                \   ddl m} t               }t        j                  d      |_        t        j                  d      }d|_        |j                  t        j                  |             | j                  |j                  d   j                  d       | j                  |j                          |dd      d       | j                  |j                   j                  dd       t               }t        j                  d      |_        t        j                         }d	|_        t        j                         }d
|_        |j                  |       |j                  |       | j                  |j                          |dd      d       | j                  |j                   j                  d       y )Nr   rD  r/   zB--2r5   r7   rn   rx   r   r   r6   r3   r   )rG  rE  r   r   r;   r   r   r<   r   rW   rX   rY   r   r   r   barDurationProportionrL  )rB   rE  r   r   r   r   s         rH    testMeasureBarDurationProportionz%Test.testMeasureBarDurationProportionI  s5   &I--e4IIf	q!"**A.002HQNAF44a; I--e4YY[YY[		002HQNAF44c:rJ   c                `   g d}t        j                         }d|_        t               }|j	                  ||       g d}|D ]  \  }}}}t        j                  |      }	| j                  |	j                  d       | j                  |	j                  d       t        j                         }
||
_        |	j                  ||
       | j                  |	j                  |       | j                  |	j                  |       | j                  t        |	      t        |      dz          t        j                  |      }	t        j                  |	j                         |	j                          | j                  |	j                  d       | j                  |	j                  d       t        j                         }
||
_        |	j                  ||
       | j                  |	j                  |       | j                  |	j                  |       | j                  t        |	      t        |      dz           y )Nr   r6   rn   r   r   ry   r  r6   )r   r        (@     ,@)r7   r   r,  r-  )      @r        2@     4@)r   rn   r$  r%  )r7   rn   r,  r-  )r&  rn   r'  r(  )r5   r6   r(  r,  )r6   r6   r+  r   )r5   r7   r  r+  )r6   r7   r(  r,  )r5   rn   r(  r,  )r6   rn   r+  r   )r6   r  g      )@      -@)rY  rn   r)       0@r  r+  r5   )r   r<   r   r   r>   rX   rY   r   r?  r@  insertAndShiftr   r   shuffle	_elementsrH  )rB   r$  r   r   dataqLinsertOffsetnewHighOffsetnewHighTimesProcnAlters              rH   testInsertAndShiftBasiczTest.testInsertAndShiftBasico  s   )IIKH	q'"
. =A8Bm[MM!$EU00"5U..3YY[F#%F   v6U00-@U..<SZQ!4 MM!$ENN5??+%%'U00"5U..3YY[F#%F   v6U00-@U..<SZQ!4/ =ArJ   c                <   g d}t        j                         }d|_        t               }|j	                  ||       g d}|D ]  \  }}}t        j                  |      }| j                  |j                  d       | j                  |j                  d       t        j                         }	|j                  ||	       | j                  |j                  |       | j                  |j                  |       | j                  t        |      t        |      dz           y )Nr"  r6   )	r   r  r+  r7  r7  rn   r  r+  r8  r8  r6   r  r+  r9  )r7   r  r+  r  r+  r5   )r   r<   r   r   r>   rX   rY   r   r?  r@  r   r  r+  r   )
rB   r$  r   r   r.  r0  r1  r2  r3  rg   s
             rH   testInsertAndShiftNoDurationz!Test.testInsertAndShiftNoDuration  s    )IIKH	q'"

 9=4L-MM!$EU00"5U..3		A  q1U00-@U..<SZQ!4 9=rJ   c                   g d}t        j                         }d|_        t               }|j	                  ||       g d}|D ];  \  }}}}t        j                  |      }	| j                  |	j                  d       | j                  |	j                  d       t        j                         }
d|
_        g }|}|||z   k  rC|j                  |       |j                  t        j                  |
             |dz  }|||z   k  rC|	j                  |       | j                  |	j                  |       | j                  |	j                  |       | j                  t        |	      t        |      t        |      dz  z          > y )Nr"  r6   r#  r  r+  r   )r   r<   r   r   r>   rX   rY   r   r?  r@  rW   r+  r   )rB   r$  r   r   r.  r/  r0  r1  r2  r3  r4  itemListr   s                rH   "testInsertAndShiftMultipleElementsz'Test.testInsertAndShiftMultipleElements  sM   )IIKH	q'"
. =A8Bm[MM!$EU00"5U..3 YY[F#'F HAlR''"f 56T	 lR''   *U00-@U..<SZQ#h-!2C)CD' =ArJ   c                @   t               }t        j                         }|j                  |       t	        j
                         |_        d|j                  _        d|j                  _        t        j                         }|j                  |      j                  d      }y )NzFrank the Composerz
work titlerg  )r   r   r<   rW   r   Metadatacomposertitler*   rh  r   ri  )rB   r   r   rj  rk  s        rH   testMetadataOnStreamzTest.testMetadataOnStream  sm    HYY[	&&(
2

'

,,.IIaL''0	rJ   c                   t               }t        j                  d      |_        | j	                  t        |      d       t        j                  d      }||_        | j	                  t        |      d       | j	                  |d   |       | j	                  |j                  d        t        j                  d      }| j	                  |j                  j                  d       ||_	        | j	                  t        |      d       t        j                  d      }t        j                  d      }||_        | j	                  t        |      d       | j	                  |j                  |       ||_	        | j	                  t        |      d       | j	                  |j                  |       t               }|j                  t        j                  |             |j                  t        j                  |             t               }| j	                  t        |      d       ||_	        | j	                  t        |      d       | j	                  |j                  d        | j	                  |j                  |       y )	Nr/   r5   heavyr6   r   r   r7   r  )r   r   r;   r   r   r   r   r  leftBarliner  rL  r   r
   rW   rX   rY   )rB   r  b1b2b3r  rs   r	  s           rH   testMeasureBarlinezTest.testMeasureBarline  s   Y ..u5R!$[[!R!$A#$/[[!55s; 	R!$[["[[!R!$,R!$"-F	r"#	r"#
 YR!$R!$."-rJ   c                   t               }t        dd      D ]|  }t        j                         }t	               }|j                  |       |dz  |_        |dz  dk(  r(t        j                  d      }|j                  d|       |j                  |       ~ t        j                         }|j                  |      j                  d      }y	)
z;
        test both system layout and measure width
        r5   ry   r  r6   r   T)isNewrg  N)r   rV   r   r<   r   rW   layoutWidthr   SystemLayoutr@   r*   rh  r   ri  )rB   r   ra   r   r   slrj  rk  s           rH   testMeasureLayoutzTest.testMeasureLayout0  s     Hq"A		A	AHHQKGAM1uz((t4BHHQK  ,,.IIaL''0	rJ   c                   t        j                         }d|_        t        j                         }d|_        t        j                         }d|_        t        j                         }d|_        t               }d|_        |j	                  |       t               }d|_        t               }d|_        |j	                  |       t               }d|_        t               }	d	|	_        t               }
d
|
_        |
j	                  |       |
j	                  |       t               }d|_        t               }d|_        t               }d|_        t               }d|_        |j	                  |	       |j	                  |
       |j	                  |       |j	                  |       |j	                  |       |j	                  |       |j	                  |       |j	                  |       |j	                  |       g }|j                  dd      D ]  }|j	                  |j                          | j                  |g d       g }|j                  dd      D ]  }|j	                  |j                          | j                  |g d       g }|j                  dd      D ]  }|j	                  |j                          | j                  |g d       y )Nn(1a)n2(2b)n3(3b)n4(3b)1a2a2b2c3a3b3c3d3e3fT)streamsOnlyincludeSelf)
rU  rV  rY  rZ  r[  rW  r\  r]  rX  r^  F)rU  rQ  rV  rY  rZ  rS  rT  r[  rW  rR  r\  r]  rX  r^  )rV  rY  rZ  rS  rT  r[  )r   r<   r   r   rW   r   r   )rB   r   r   r   r   ri   rj   r  r  r  r  r  s8s9s10r  r   s                    rH   testYieldContainerszTest.testYieldContainersE  s3   YY[YY[YY[YY[X
		"XX
		"XXX
		"
		"XXXh 			"
		"
		"
		"
		"
		#
		"
		"
		" $?ALL @ 	 \] 4@ALL A 	 !I 	J 4@ALL A 	 LMrJ   c                    ddl m}m} d  _         fd}t	               }t        j                  d      }d|_        |j                  |d       t        j                  |      } j                  t        |d   j                        d        j                  t        |d   j                        d	z  d       t        j                  |      }d|j                  d fd|j                   d fd|j"                  d
fd|j$                  d
fd|j"                  d
fd|j$                  d
fd|j"                  d
fd|j$                  d
fd|j"                  d
fd|j$                  d
fd|j"                  d
fd|j$                  d
fd|j"                  d
fd|j$                  d
fd|j&                  d fg} |||       t	               }t        j                  d      }d|_        |j                  |d       t        j                  |      }d|j                  d fd|j                   d fd|j"                  d
fd|j$                  d
fd|j"                  d
fd|j$                  d
fd|j"                  d
fd|j$                  d
fd|j&                  d fg	} |||       t	               }g d}	|	D ]2  \  }
}t        j                  |
      }||_        |j)                  |       4 t        j                  |      }d|j                  d fd|j                   d fd|j"                  dfd|j$                  dfd|j"                  dfd|j$                  dfd|j"                  d
fd|j$                  d
fd|j"                  dfd|j$                  dfd|j"                  dfd|j$                  dfd|j&                  d fg} |||       t	               }g d}	|	D ]I  \  }
}|
t        j*                         }nt        j                  |
      }||_        |j)                  |       K t        j                  |      }d|j                  d fd|j                   d fd|j"                  dfd|j$                  dfd|j"                  dfd|j$                  dfd|j"                  dfd|j$                  dfd|j"                  dfd|j$                  dfd|j&                  d fg} |||       t	               }g d}	|	D ]I  \  }
}|
t        j*                         }nt        j                  |
      }||_        |j)                  |       K t        j                  |      }d|j                  d fd|j                   d fd|j"                  dfd|j$                  dfd|j"                  dfd|j$                  dfd|j"                  dfd|j$                  dfd|j"                  dfd|j$                  dfd|j&                  d fg} |||       t	               }g d}	|	D ]I  \  }
}|
t        j*                         }nt        j                  |
      }||_        |j)                  |       K t        j                  |      }d|j                  d fd|j                   d fd|j"                  dfd|j$                  dfd|j"                  dfd|j$                  dfd|j"                  dfd|j$                  dfd|j"                  dfd|j$                  dfd|j"                  dfd|j$                  dfd|j&                  d fg} |||       t	               }ddg ddfdddd d!gdfg d"dfdg d#d$fg
}	|	D ]o  \  }
}|
t        j*                         }n;t-        |
t.              rt1        j2                  |
      }nt        j                  |
      }||_        |j)                  |       q t        j                  |      }d|j                  d fd|j                   d fd|j"                  dfd|j$                  dfd|j"                  d%fd|j"                  d&fd|j"                  d'fd|j$                  d%fd|j$                  d&fd|j$                  d'fd|j"                  dfd|j$                  dfd|j"                  d(fd|j"                  dfd|j$                  d(fd|j$                  dfd|j"                  d)fd|j"                  d*fd|j"                  d+fd|j$                  d)fd|j$                  d*fd|j$                  d+fd|j"                  d,fd|j"                  dfd|j"                  d-fd.|j$                  d,fd|j$                  dfd|j$                  d-fd|j&                  d fg} |||       y )/Nr   )
MetaEventsChannelVoiceMessagesc                l   g }t        dt        | j                  d   j                        d      D ]o  }| j                  d   j                  |   }| j                  d   j                  |dz      }|j	                  |j
                  |j                  |j                  f       q j                  ||       y )Nr   r5   r6   )	rV   r   trackseventsrW   timer2   r    r   )mf_innermatch_innertriplesra   deltar   rB   s         rH   r  z-Test.testMidiEventsBuilt.<locals>.procCompare  s    G1c(//!"4";";<a@ *11!4OOA&--a!e4

AFFAGG<= A
 Wk2rJ   g#3r   r   r5   r   r6   8   i  i`'  r   r7   i;  ))r  r   )c#3r   )rp  r   rW  r5   )rV  r6   rG  i	  1   rX  r  iN  )r  r5   Nr   rr  r5   rv  rs  rv  rV  r5   )ru  )Nr   rw  )Nr   rs  Nr6   rx  )ru  Nr5   rz  rw  rw  rv  rv  rv  rv  rs  ry  rx  ru  rz  )f3za-4rx  rv  rs  ry  r   rV  )zd-2za#3zg#6)zf#3rV  ry  rn   5   D   H   &   rC  :   \   6   r`  i  )music21.midirf  rg  maxDiffr   r   r<   r   r   midiTranslatestreamHierarchyToMidiTracksr   r   rj  streamToMidiFileSEQUENCE_TRACK_NAME
PITCH_BENDNOTE_ONNOTE_OFFEND_OF_TRACKrW   r  
isinstancer   r   r  )rB   rf  rg  r  r   r   ru  mfr  r.  rs   rh   s   `           rH   testMidiEventsBuiltzTest.testMidiEventsBuilt  s%
   A	3 HIIe	q!88;T!W^^,b1T!W^^,q0!4++A.
..5$//6$,,b1'00"5$,,b1'00"5$,,b1'00"5$,,b1'00"5$,,b1'00"5$,,b1'00"5J++T2
$ 	BHIIe	q!++A.
..5$//6$,,b1(1126$,,b1(1126$,,b1(1126J++T2

 	B H
 DAq		!AAOHHQK 
 ++A.
..5$//6$,,b1'00"5$,,b1'00"5$,,b1(1126$,,b1(1126$,,b1(1126J++T2
 	B H
 DAqyIIKIIaLAOHHQK  ++A.
..5$//6$,,b1(1126'//4(1126'//4(1126'//4(1126J++T2
 	B H
 DAqyIIKIIaLAOHHQK  ++A.
..5$//6$,,b1(1126'//4(1126(00"5(1126(00"5(1126J++T2
 	B H
 DAqyIIKIIaLAOHHQK  ++A.
..5$//6$,,b1(1126(00"5(1126$,,b1(1126(00"5(1126(00"5(1126J++T2
 	B H !$D\3"C(!1%
 DAqyIIKAt$KKNIIaLAOHHQK  ++A.
..5$//6$,,b1(1126(00"5$,,b1$,,b1(1126$--r2$--r2'//4(1126(00"5$,,b1'00"5$--r2$,,b1$,,b1$,,b1'00"5$--r2$--r2(00"5$,,b1$,,b1(1126$--r2$--r2J++T2;
> 	BrJ   c                8   t               }t        j                         }|j                  |g d       |j	                         }|D cg c]1  }|j
                  |j
                  |j                  j                  z   f3 }}g d}| j                  ||       | j                  t        |      d       |j                  dd       | j                  t        |      d       | j                  t        |j                  t        j                              d       y c c}w )N)r   r   rY  rn   r   ))r   r   )r  r   )r   r  r3   T)r  r  r   r7   )r   r   r<   r>   findGapsr   r   r   r   r   r  r[  r  )rB   r   r   ru  r   testr  s          rH   testFindGapszTest.testFindGaps  s    HIIK	q-.zz|IMNA188ajj&>&>>?N4u%Q#	D40Q#Q11$))<=qA Os   6Dc                     fd}ddl m}  |g dg dg dg ddg        |g dg dg dg dd	g        |g d
g dd |d       |d      ddg |d       |d       |d      ddgddg        |g dg dd |d       |d      ddg |d       |d       |d      ddgd	dg        |g dg dd |d       |d      ddg |d       |d       |d      ddgd	dg        |g dg ddd |d       |d      d |d       |d      g |d       |d       |d       |d       |d       |d      dgddg       y ) Nc                   t               }t        | |      D ]2  \  }}t        j                         }||_        |j                  ||       4 |j                          |j                  |ddd       |D 	cg c]  }	|	j                   }
}	|D 	cg c]  }	|	j                  j                   }}	j                  |
|       j                  ||       y c c}	w c c}	w )NT)processOffsetsprocessDurationsr  )r   r  r   r<   r   r@   r  quantizer   r   r   )	srcOffsetsrcDur	dstOffsetdstDurdivListr   nOffset	nDurationr   r   targetOffset	targetDurrB   s               rH   r  z&Test.testQuantize.<locals>.procCompare  s    A&))V&<"IIK"+!$ '=
 FFHJJwtdTXJY./0aAHHaL0;<=1a111I=\95Y/	 1=s   6CCr   rD  ){Gz?Q?g=
ףp=?(\?)r   r   r   r   )r   r   r   r  rn   )r  r  gp=
ף?r  r   )r  Gz?gv?RQ?gQ?)ףp=
?{Gz?Q?r   r   r   z1/3z2/3r   r   r   r7   )r  r  gCl?gGz?{Gz?)r  r  r  )\(?zG?)gQ?gq=
ףp?gDl?r  r  )r  gffffff?r  r  r  r   )gT㥛  @gh|?5 @gDl@g^I+@r   g/$
@gh|?5@)grh|?gˡE?g9v?gMb?g㥛 ?gMbX?g?5^I?r6   z7/3z8/3r   z10/3z11/3)rG  rE  )rB   r  r   s   `  rH   testQuantizezTest.testQuantize  s~   	0$ 	,,.F*,DC	 	,.F*,DC	 	42!E(AeHc48uXqx54>F	 	42!E(AeHc48uXqx54>F	 	42!E(AeHc48uXqx54>F	 	CE1U8QuXsAfIqyIuXqx51U8uXqx/ F	rJ   c                b   t        j                         dz  dz  }|dz  }t        j                  |dg      }|j	                         j
                  d   }| j                  |j                  j                  d       | j                  |j                  j                  d       t               }|j                  t        j                  d	
      d       |j                  t        j                  d
      d       |j!                  ddg       | j                  t#        |j$                        d       y)z
        Notes (not rests!) of nonzero duration should retain a nonzero
        duration after quantizing. Zero duration rests should be removed.
        midir  z
test15.midr6   )quarterLengthDivisorsrP   r   g      ؿ16thr1   r7   32ndT)r  r  N)r   getSourceFilePathr   r   r   r   r   r   r   	editorialquarterLengthQuantizationErrorr   r   r   r<   r  r  r   r  )rB   dirLibfpr   	last_noterj   s         rH   testQuantizeMinimumDurationz Test.testQuantizeMinimumDuration  s    
 ))+f4Fl"OOBqc:IIK%%b)	++993?,,KKYW X
		v.2
		v.2
D<R--.2rJ   c                l   t        j                  d      }|j                  d   |j                  d   |j                  dd      |j                  d   j                  dd      g}t	        j
                  d      t	        j
                  d      t	        j
                  d	      t	        j
                  d
      g}dD ]K  }t        ||      D ]:  \  }}|j                  |      }| j                  t        |      t        |             < M t        j                  d      dft        j                  d      dft        j                  d      dft        j                  d      dfg}dD ]y  }t        ||      D ]h  \  }}	|j                  |      }| j                  |j                  j                  |	d   j                         | j                  |j                  |	d          j { t        j                  d      dft        j                  d      dft        j                  d      dft        j                  d      dfg}
dD ]y  }t        ||
      D ]h  \  }}	|j                  |      }| j                  |j                  j                  |	d   j                         | j                  |j                  |	d          j { y )NrB  r   r5   rn   r3   r6   r  r,     ry   )rV   ambitusspanF#minorr   r   major)KrumhanslSchmuckler	krumhansl)arden)r   r   r   r  r   Intervalr  analyzer   r   r    Pitchtonicr   mode)rB   r   r  matchAmbitusidStrsTestmatchAmbitusTestru  matchKrumhanslsMatch
matchArdens              rH   testAnalyzezTest.testAnalyze*  sF   LL(wwqz1771:qzz!Q'7
##Aq)+ !))"- ))"- ))"- ))"-/ 2E+.sL+A''}}U+  TC0@,AB ,B 2 !;;t,g6 ;;t,g6 ;;s+W5 ;;s+W57 :E!$S.!9v}}U+  &)..A  F1I6	 ": : {{4('2{{4('2{{4('2{{3'13
 E!$S*!5v}}U+  &)..A  F1I6	 "6 rJ   c                ,   ddl m} d }d }t               }g d}|D ].  }t        j                         }||_        |j                  |       0 |j                  |d       | j                   ||      g d       | j                   ||      g d	       y
)#
        Creating brackets
        r   r  c                    g }| D ]\  }|j                   j                  r3|j                  |j                   j                  d   j                         L|j                  d        ^ |S r  r   r]   rW   r2   ssru  r   s      rH   collectTypez1Test.testMakeTupletBracketsA.<locals>.collectType[  R    D::%%KK

 2 21 5 : :;KK%	 
 KrJ   c                    g }| D ]\  }|j                   j                  r3|j                  |j                   j                  d   j                         L|j                  d        ^ |S r  r   r]   rW   bracketr  s      rH   collectBracketz4Test.testMakeTupletBracketsA.<locals>.collectBracketd  R    D::%%KK

 2 21 5 = =>KK%	 
 KrJ   )r5   r6   r   UUUUUU?Tr  )NNN	startStop)NNNFN	music21.streamr  r   r   r<   r   rW   makeTupletBracketsr   rB   r  r  r  r   qlListrH  r   s           rH   testMakeTupletBracketsAzTest.testMakeTupletBracketsAU  s     	0		 H#B		A AOHHQK  	''4'8Q)HI*,EFrJ   c                   ddl m} d }d }t               }g d}|D ].  }t        j                         }||_        |j                  |       0 |j                  |d       | j                   ||      g d       t               }g d	}|D ].  }t        j                         }||_        |j                  |       0 |j                  |d       | j                   ||      g d
       t               }g d}|D ].  }t        j                         }||_        |j                  |       0 |j                  |d       | j                   ||      g d       t               }g d}|D ].  }t        j                         }||_        |j                  |       0 |j                  |d       | j                   ||      g d       | j                   ||      g d       t               }g d}|D ].  }t        j                         }||_        |j                  |       0 |j                  |d       | j                   ||      g d       t               }g d}|D ].  }t        j                         }||_        |j                  |       0 |j                  |d       | j                   ||      g d       | j                   ||      g d       t               }g d}|D ].  }t        j                         }||_        |j                  |       0 |j                  |d       | j                   ||      g d       | j                   ||      g d       y)r  r   r  c                    g }| D ]\  }|j                   j                  r3|j                  |j                   j                  d   j                         L|j                  d        ^ |S r  r  r  s      rH   r  z1Test.testMakeTupletBracketsB.<locals>.collectType  r  rJ   c                    g }| D ]\  }|j                   j                  r3|j                  |j                   j                  d   j                         L|j                  d        ^ |S r  r  r  s      rH   r  z4Test.testMakeTupletBracketsB.<locals>.collectBracket  r  rJ   )r5   rh  rh  rh  r5   r5   Tr  )NrN   NrO   NN)	r5   r  r  r  r  r  r  r5   r5   )	NrN   NrO   rN   NrO   NN)r5   r6   r   r  r  r  )NNNrN   NrO   )r5   rh  r5   rh  r5   rh  )Nr  Nr  Nr  )NFNFNF)r5   rh  rj  rj  r  r  r5   )NrN   rO   rN   NrO   N)r5   rh  rj  r5   r  rh  rh  r  )NrN   rO   NrN   rO   rN   rO   )NTTNTTTT)r5   皙?r  皙?r  r  r  r   )NrN   NNNNrO   N)NTTTTTTNNr  r  s           rH   testMakeTupletBracketsBzTest.testMakeTupletBracketsBz  s    	0		 H/B		A AOHHQK  	''4'8Q)RS HDB		A AOHHQK  	''4'8 	QY	[
 H3B		A AOHHQK  	''4'8Q)RS H/B		A AOHHQK  	''4'8QR	T*,ST H:B		A AOHHQK  	''4'8Q)]^ HAB		A AOHHQK  	''4'8QX	Z*I	K
 HEB		A AOHHQK  	''4'8Q)^_*,\]rJ   c                t   d }d }t               }dg}|D ].  }t        j                         }||_        |j	                  |       0 |j                         }| j                   ||j                         j                        dg       | j                   ||j                         j                        dg       y)z8
        This is a test of many make procedures
        c                    g }| D ]\  }|j                   j                  r3|j                  |j                   j                  d   j                         L|j                  d        ^ |S r  r  r  ru  r   s      rH   collectTupletTypez1Test.testMakeNotationA.<locals>.collectTupletType  sR    D::%%KK

 2 21 5 : :;KK%	 
 KrJ   c                    g }| D ]\  }|j                   j                  r3|j                  |j                   j                  d   j                         L|j                  d        ^ |S r  r  r  s      rH   collectTupletBracketz4Test.testMakeNotationA.<locals>.collectTupletBracket  sR    D::%%KK

 2 21 5 = =>KK%	 
 KrJ   rh  r  FN)	r   r   r<   r   rW   r  r   r   r   )rB   r  r  r   r  rH  r   postMakes           rH   testMakeNotationAzTest.testMakeNotationA  s    		* HB		A AOHHQK  >>#*8+;+;+=+C+CD{mT-h.>.>.@.F.FG%QrJ   c                ~   ddl m} t               }|j                  d |              |j                  dt	        j
                  dd             |j                  t	        j
                  dd      t        d      D cg c]  }|dz  	 c}       |j                  t	        j
                  d	d
      g d       |j                         }| j                  t        |j                        d       | j                  t        |j                        d       | j                  t        |j                  t                    d
       | j                  t        |j                  t              d   j                        d       | j                  t        |j                  t              d   j                        d       |j                  t              D ]E  }|j                  d   j                  D ]'  }| j                  t        |j                         d       ) G | j#                  |j%                  d      d   |       yc c}w )zE
        Testing voices making routines within make notation
        r   )	Xylophonerd   r   rF  b-4r   r   zf#5r6   )r   r6   rn   r   r  r7   r5   Tr.  N)music21.instrumentr  r   r@   r   r<   r>   rV   r  r   r   r  r   r[  r   assertGreaterr2  rV  getInstruments)rB   r  r   r   rI  r   r   s          rH   testMakeNotationBzTest.testMakeNotationB  s    	1H	IK 	DIId!45	tyyc:eTVi<XiQWi<XY	tyya8,G  	QXX*QWWr*U55g>?CU55g>qAHHI1MU55g>qAHHI1M))'2AXXa[&&""3qww<3 ' 3
 	e2242@CYO% =Ys   =H:
c           
     n   t               }dD ]<  }dD ]5  }|j                  |t        j                  d|dz  z   |dz  z   |             7 > |j	                         }| j                  t        |j                  t                    d       | j                  t        |j                  t              d   j                        d       | j                  t        |j                  t              d	   j                        d       | j                  |j                         j                  d
   j                         y)zH
        Test creating diverse, overlapping durations and notes
        )r   r   r7   )r   r   rn   r   r  r6   rF  r7   r   rn   r5   rP   N)r   r@   r   r<   r  r   r   r[  r   r  r  r   r   r&   )rB   r   r8  r   rI  s        rH   testMakeNotationCzTest.testMakeNotationC0  s     H C(2q>VaZ+H9<"> ? ) !  U55g>?CU55g>qAHHI1MU55g>qAHHI1MU]]_2226::;rJ   c                p   t               }t               }t               }||fD ]8  }|j                  t        j                         d       |j                  d|       : | j                  |j                                | j                  |j                  t              d   j                                | j                  |j                  t              d   j                                |j                  d      }| j                  |j                                | j                  t        |j                  t              j                         j                  t                    d       | j                  t        |j                  t              d   j                  t                    d       | j                  t        |j!                         j                  t"        j$                              d       | j                  t        |j!                         j                  t&        j(                              d       y)	4
        Test makeNotation on Score objects
        r  r   r5   Fr  r7   r6   N)r	   r   r   r   r<   r@   r   hasPartLikeStreamsr   r[  hasMeasuresr  r   r   r  r   r   r   r;   r   r  rB   r   r   r   rs   ru  s         rH   testMakeNotationScoreAzTest.testMakeNotationScoreAB  s    GXXbANN499;+HHQN  	,,./--f5a8DDFG--f5a8DDFG~~e~,//12 	T44V<BBDWWX_`a	T44V<Q?RRSZ[\	T\\^>>u?R?RSTVWXT\\^>>tyyIJANrJ   c                   t               }t               }t               }||fD ]8  }|j                  t        j                         d       |j                  d|       : | j                  |j                                | j                  |j                  t              d   j                                | j                  |j                  t              d   j                                |j                  dt        t        j                  d      g            }| j                  |j                                | j                  t        |j                  t              d   j                  t                     d       | j                  t        |j                  t              d   j                  t                     d       | j                  t        |j#                         j                  t        j                              d       | j                  t        |j#                         j                  t$        j&                              d       y	)
r  r  r   r5   Fr/   r  r  rn   r6   N)r	   r   r   r   r<   r@   r   r  r   r[  r   r  r   r;   r   r   r   r   r   r  r  s         rH   testMakeNotationScoreBzTest.testMakeNotationScoreB]  s    GXXbANN499;+HHQN  	,,./--f5a8DDFG--f5a8DDFG ~~e  '(:*~ + 	//12 	T44V<Q?RRSZ[\^_`T44V<Q?RRSZ[\^_`T\\^>>u?R?RSTVWXT\\^>>tyyIJANrJ   c                   t               }t               }t               }||fD ]8  }|j                  t        j                         d       |j                  d|       : |j                  t              j                         j                  dt        t        j                  d      g             | j                  |j                  t              d   j                                | j                  |j                  t              d   j                                |j                  d      }| j                  t        |j                  t              d   j                  t                     d	       | j                  t        |j                  t              d   j                  t                     d
       | j                  t        |j#                         j                  t        j                              d       | j                  t        |j#                         j                  t$        j&                              d       y)r  r  r   Tr/   r  r5   Fr  rn   r7   r6   N)r	   r   r   r   r<   r@   r[  r  r  r   r;   r   r   r   r   r   r   r   r   r  r  s         rH   testMakeNotationScoreCzTest.testMakeNotationScoreCz  s    GXXbANN499;+HHQN 
 	
V$**,99 3 3E :;< 	: 	> 	,,V4Q7CCEF--f5a8DDFG~~e~,T44))'2456	8T44))'2456	8 	T\\^>>u?R?RSTVWXT\\^>>tyyIJANrJ   c                   d}t        j                         }t        j                  d      }t	        j
                  |      }t               }|j                  d|       |j                  d|       |j                  d|       |j                  dt        j                  d             |j                  dt        j                  d             |j                         }| j                  t        |j                  t                    d       |j                  t              j                         }| j                  |j                   j"                  |       y)	z
        The base-case: Stream should keep it's key.KeySignature element when a
        single-voice score is prepared for notation.
        r6   r   r   r   r   rr  r5   Nr   r<  r   r;   r   r=  r   r@   r   r<   r  r   r   r[  r   r  rM  r4  rB   sharpsInKeyrg   rD   r?  r   rI  r  s           rH   $testMakeNotationKeySignatureOneVoicez)Test.testMakeNotationKeySignatureOneVoice  s    
 OO  'k*H	a	b	b	diin%	diin% U55g>?C%%g.446//=rJ   c                   d}t        j                         }t        j                  d      }t	        j
                  d      }t               }|j                  d|       |j                  d|       |j                  d|       |j                  dt        j                  d             |j                  dt        j                  d             |j                         }| j                  t        |j                  t                    d       |j                  t              j                         }|j                   J | j                  |j                   j"                  |       y)	z|
        Stream should keep its key.KeySignature element
        when a multi-voice score is prepared for notation.
        r6   r   r   r   r   rr  r5   Nr	  r
  s           rH   &testMakeNotationKeySignatureMultiVoicez+Test.testMakeNotationKeySignatureMultiVoice  s    OO  'a H	a	b	b 	
diin%	diin% U55g>?C%%g.446***//=rJ   c                   d }t        j                  d      }|j                  d   j                  dd      }| j	                   ||      g d       |j                         j                  j                         }| j	                  t        |      d       |j                  dt        j                  d	             |j                  dd
       |j                  d       }|j                  d
       | j	                  t        |j                               d       | j	                   ||      g d       |j                         j                  dd
       d | _        | j	                   ||      g d       y )Nc                "   g }| j                         j                  D ]o  }|j                  j                  F|j	                  |j                  j
                  |j                  j                  j                  f       _|j	                  d       q |S )Nr   )r   r  r    r\   rW   r   r[  r  s      rH   collectAccidentalDisplayStatusz9Test.testMakeTies.<locals>.collectAccidentalDisplayStatus  sj    D__&4477%%1KKqww/A/A/O/O PQKK$	 5
 KrJ   rB  r7   r6   r   )r   r   Fr   r   E#Tr  Fr   r  r  r  r  Fr  r  r   r   r   r  r  r  r   r   r   r   r  r     r   rL   Tr  r  rE  )+r   r  r  r   r   r   r   r  r  Fr  r   r  r  r  r  r  r  r  r  r  r  r   r   r   r   r  r  r  r  r  r  r   r   r   r   r   r   r   r   r  r  r  r  p5)+r   r  Nr  r   r   r   r   zB#Nr  r   Nr  Nr  r  r  r  r  r  r  Nr  r  r  r   r   r  r  r  r  r  r  r  r  r   r   r   r   r   r   r  r  r  r  r  r  )r   r   r   r  r   r   r  r  r   r@   r   r;   r  r  r  r  r  )rB   r  r   sSubmStreams        rH   testMakeTieszTest.testMakeTies  sJ   	 LL(wwqz""1a( 	7=7	8 ||~++224TB'Au**512q$/ ###6&W__./4 	7@U		 	##D$#7 7@6		rJ   c                   t               }t        d      }|j                  t        j                  d             |j                  t        j                  d             |j                  |       |j                         }| j                  t        |t                 d       |t           j                         j                  j                         }|t           j                         j                  j                         }| j                  |j                  j                  d       | j                  |j                  j                  d       | j                  |j                          | j                  |j                          | j                  |j                   j"                  d       | j                  |j                   j"                  d	       |j%                         }| j                  t        |t                 d       y
)z
        Test that makeTies adds a new measure when the last note is too long,
        both when called directly and when called from makeNotation
        r5   r  r   brever1   r6   r   rN   rO   N)r
   r   rW   r   r;   r   r<   r  r   r   r  r   r  r   r   r  r&   r2   r  )rB   rs   r   
p_makeTiesr   r   p_makeNotations          rH   testMakeTiesAddNewMeasurezTest.testMakeTiesAddNewMeasure
  sc   
 F1	$$U+,	()	ZZ\
Z0115 &&(..446 %%'--33522C822C8RVV$RVV$g.f-)^G45q9rJ   c                    t        j                  d      }|j                  dd      }| j                  t	        |j
                        d       y )Nz"tinynotation: 2/8 g8 e f g e f g ar7   z4[<music21.pitch.Pitch E4>, <music21.pitch.Pitch F4>])r   r   r  r   r   rN  )rB   r   r  s      rH   testMeasuresAndMakeMeasuresz Test.testMeasuresAndMakeMeasures"  s;    OO@Azz!QT\\*,bcrJ   c                   t               }d|_        t        j                  d      }t        j                  d      }|j	                  d|       |j	                  d|       | j                  |D cg c]  }|j                   c}ddg       |j                         }| j                  |D cg c]  }|j                   c}ddg       | j                  |D cg c]  }|j                   c}ddg       |j                          | j                  |D cg c]  }|j                   c}ddg       t               }d|_        t        j                  d      }t        j                  d      }|j	                  d|       |j	                  d|       | j                  |j                  D cg c]  }|j                   c}ddg       t               }d|_        t        j                  d      }t        j                  d      }|j	                  d|       |j	                  d|       | j                  |j                  D cg c]  }|j                   c}ddg       t               }d|_        t        j                  d      }t        j                  d      }|j	                  d|       |j	                  d|       | j                  |d   j                  d       | j                  |d	   j                  d       t               }d|_        t        j                  d      }t        j                  d      }|j	                  d|       |j	                  d|       | j                  |d   j                  d       | j                  |d	   j                  d       t               }d|_        t        j                  d      }t        j                  d      }|j	                  d|       |j	                  d|       | j                  |j                  d   j                  d       | j                  |j                  d	   j                  d       t               }d|_        t        j                  d      }t        j                  d      }|j	                  d|       |j	                  d|       | j                  |j                  d   j                  d       | j                  |j                  d	   j                  d       g d
}t               }d|_        |D ]2  \  }}t        j                         }	||	_        |j	                  ||	       4 g }
|j                  D ])  }	|
j                  |	j                  |	j                  f       + | j                  ||
       t               }d|_        |D ]2  \  }}t        j                         }	||	_        |j	                  ||	       4 g }
|j                  D ])  }	|
j                  |	j                  |	j                  f       + | j                  g d|
       y c c}w c c}w c c}w c c}w c c}w c c}w )NFrs  r  r  r   TrC   rE   r5   ))r{   r6   )r,  ry   )   r5   )ry   r6   )r3   r  )r   ry   )r   r6   )r   r   ))r   r6   )r   r   )r   r  )r  ry   )r	  r6   )r  ry   )r   r6   )r  r   )r   r  r   r<   r@   r   r   r   r  r  r[   r   rW   r   )rB   r   r   r   r   sSortedpairsr   rh   r   r  s              rH   testSortAndAutoSortzTest.testSortAndAutoSort(  s   H
YYs^YYs^	b	B!,!Q!&&!,sCj9((*!,!Q!&&!,sCj9'2'Q!&&'2S#J?	!,!Q!&&!,sCj9 H
YYs^YYs^	b	B 	!//:/Q!&&/:S#JG H
YYs^YYs^	b	B!//:/Q!&&/:S#JG H
YYs^YYs^	b	B1C(1C( H
YYs^YYs^	b	B1C(1C( H
YYs^YYs^	b	BA++S1A++S1 H
YYs^YYs^	b	BA++S1A++S1 Y H
DAq		AAOHHQN  ALL!((AOO45 !& H
DAq		AAOHHQN  ALL!((AOO45 ! >?D	FC - -2 - ; ;s$   /X%+X*X/X4(X9=X>c           	     >   g d}g dg dg dg dfD ]  }t               }d}t        ||      D ]?  \  }}|D ]0  }t        j                  |      }||_        |j                  ||       2 ||z  }A | j                  t        |      d       | j                  t        |j                  t        j                              d       |j                         }	|j                         }||	fD ]  }
| j                  t        |
j                  t        j                              d       t        |      D ]c  \  }}|
j                  t        j                        |   j                  D cg c]  }|j                   }}| j                  |t        |             e   y c c}w )	N))C2A2)zA#1zC-3G5)r  r  D3rd   )r5   r5   r5   )r   r6   r7   )r   r   r   )r   r   r   r   r)  r7   )r   r  r   r<   r   r@   r   r   r[  r   r  chordifyr  rN  nameWithOctaver   )rB   pitchColdurColr   r   rH  rN  pStrr   sModsEvalra   pitchElrs   r  s                  rH   testMakeChordsBuiltAzTest.testMakeChordsBuiltA  sj   0
 !+/@)LFAA"684G#D		$A&(AOHHQN $ R  5 SVQ'S!5!5ekk!BCQG ::<D

AT  U%=%=ekk%J!KQO"+H"5JAw"55ekkB1EMMOM 34Q--M  O$$UDM: #6 # M&Os   "F
c                   t        j                  d      }d|_        t        j                  d      }d|_        t        j                  d      }d|_        t        j                  d      }d|_        t               }|j	                  d|       |j	                  d|       |j	                  d|       |j	                  d	|       | j                  |D cg c]  }|j                   c}g d
       |j                         }|j                         }||fD ]f  }| j                  t        |j                  t        j                              d       | j                  |D 	cg c]  }	|	j                   c}	g d       h t        j                  d      }d|_        t        j                  d      }d|_        t        j                  d      }d|_        t        j                  d      }d|_        t               }|j	                  d|       |j	                  d|       |j	                  d|       |j	                  d	|       |j                         }y c c}w c c}	w )Nr  r6   r   r   r  f5r   r5   r7   r  r   )r   r   r   r   r   r  r   )r   r<   r   r   r@   r   r   r3  r   r[  r   r  )
rB   r   r   r   r   r   r   r8  r9  rg   s
             rH   testMakeChordsBuiltBzTest.testMakeChordsBuiltB  s   YYt_YYt_YYt_YYt_H	B	B	B	BA.Aq!((A.0DE zz|JJLYES!9!9%++!FGK61ahh68VW  YYt_YYt_YYt_YYt_H	B	B	B	B zz|? / 7s   II
c                `   t        j                  d      }d|_        t        j                  d      }d|_        t        j                  d      }d|_        t        j                  d      }d|_        t        j                  d      }d|_        t        j                  d      }d|_        t               }|j	                  d|       |j	                  d|       |j	                  d|       |j	                  d|       |j	                  d|       |j	                  d|       |j                  d      }| j                  |j                  t        j                        d   j                  D 	cg c]  }	|	j                   c}	d	d
g       | j                  |j                  t        j                        d   j                  D 	cg c]  }	|	j                   c}	ddg       |j                  d      }| j                  |j                  t        j                        d   j                  D 	cg c]  }	|	j                   c}	g d       | j                  |j                  t        j                        d   j                  D 	cg c]  }	|	j                   c}	g d       y c c}	w c c}	w c c}	w c c}	w )Nr  r   g2r  rf  r   T)removeRedundantPitchesr/  G2r5   E4ri  F)r/  r/  rB  )rC  rC  ri  )r   r<   r   r   r@   r3  r   r[  r   r  rN  r4  )
rB   r   r   r   r   r  n6ri   r8  rs   s
             rH   testMakeChordsBuiltCzTest.testMakeChordsBuiltC  sH   YYt_YYt_YYt_YYt_YYt_YYuX
		!R
		!R
		!R
		#r
		#r
		#r{{${7#'#:#:5;;#G#J#R#RT#Ra **#RT,	( 	#'#:#:5;;#G#J#R#RT#Ra **#RT-	)
 {{%{8'+'>'>u{{'KA'N'V'VW'V!Q'VW	

 	'+'>'>u{{'KA'N'V'VW'V!Q'VW	
TT X
 Xs   *J J!(J&>J+c                &   t               }|j                  t        j                  dd      t        j                  dd      t        j                  dd      t        j                  d      t        j                  dd      t        j                  dd      t        j                  dd      g       t               }|j                  t        j                  d	d      t        j                  d
d      g       t               }|j                  t        j                  d      t        j                  d      g       t               }|j                  d|g       |j                  d|g       |j                  d|g       |j                         j                         }| j                  t        |j                  t        j                              d       | j                  t        |j                  t        j                              d       y )NG4r6   rF  r  rd   rn   r5   r  A3F3r   r   r   )r
   rW   r   r<   r  r	   r@   r   r3  r   r   r[  r   r  )rB   r   r   r  r   ru  s         rH   testMakeChordsBuiltDzTest.testMakeChordsBuiltD  st   V
		499T399T399T3991-99T399T399T3 	 V
		499T399T37 	8 V
		4991-991- 	 G	!R	!R	!Ryy{##%T44TYY?@!DT44U[[ABAFrJ   c                    t        j                         dz  dz  }t        j                  |      }|j                  d   }|j                  d      }| j                  |j                  d       y)zZ
        problems with getting elements at or before when triplets were involved.
        r  ztripletOffsetBugtest.xmlr   r6   N)r   r  r   r   r   r  r   r  )rB   bugtestFiler   rs   r   s        rH   testGetElementAtOrBeforeBarlinez$Test.testGetElementAtOrBeforeBarline8  s\     ..08;>XXOOK(GGAJ""1%1%rJ   c                   t        j                         }d|_        t        j                         }d|_        t        j                         }t               }|j                  |       | j                  |j                  d       | j                  t        |      d       | j                  |d   |       | j                  |j                  |      d       | j                  |d   j                  |       |j                  |       | j                  t        |      d       | j                  |d   |       | j                  |j                  |      d       | j                  |d   j                  |       | j                  |D cg c]  }|j                   c}ddg       |j                  |       | j                  t        |      d       | j                  |d   |       | j                  |j                  |      d       | j                  |d   |       | j                  |j                  |      d       | j                  |j                  d	       | j                  |D cg c]  }|j                   c}g d
       | j                  |j                  |      d       | j                  |j                  |      d	       |j                  dd      j!                         }| j                  t        |j"                        d       |j                  dd      j!                         }| j                  t        |j"                        d       | j                  |d   |       | j                  |j%                  d	      |       | j                  |j%                  d      |       | j                  |j'                  |      |       | j                  |j'                  |      |       |j)                  t        j                        j!                         }| j                  t        |      d       | j                  |d   |       | j                  |D cg c]  }|j                   c}dg       t        j                         }	d|	_        |j                  |	       | j                  ||j                  |         j                  d       | j                  |D cg c]  }|j                   c}ddg       |j+                  t        j                        }
| j                  t        |
      d       | j                  t        |
j"                        d       |j+                  t         j                        }| j                  t        |      d       | j                  t        |j"                        d       t-        j.                  |      }| j                  |D cg c]  }|j                   c}g d
       | j1                  t3        |d         t3        |             | j5                  |d   t        j                         t        j                         }|j7                  ||       | j                  t3        |d         t3        |             | j                  |j9                  d      |       | j                  t        |      d       | j                  |D cg c]  }|j                   c}ddg       |j                  |       | j                  |D cg c]  }|j                   c}g d
       | j                  |j9                  d      |       | j                  |D cg c]  }|j                   c}ddg       | j                  |j                  |      d       yc c}w c c}w c c}w c c}w c c}w c c}w c c}w c c}w )C
        Test adding elements at the highest time position
        r   r{   r5   r   r6   r         >@r7   r  )r   r   r  r}   <   rt  ry   r	  N)r   r<   r   r   r  r   rW   r   r@  r   indexr
  
storeAtEndr   r  r>  r  r  r  getElementAfterElementr[  getElementsNotOfClassrX   rY   assertNotEqualr   rV  r_  pop)rB   r   r   rF  r   r   found1found2sub1r   sub2sub3sCopyrG  s                 rH   testElementsHighestTimeAzTest.testElementsHighestTimeAB  s    YY[YY[[[]H	+Q#1r"a(1!, 	
RQ#1r"a(1!,A.Aq!((A.d<	Q#1r"a(1r"a(+A.Aq!((A.@ 	,c2,b1 &&q"-446V112A6&&r2.557V112A6B' 	//3R8//3R8 	11"5r:11"5r: ##CKK0779TA&a"%D1Dq!((D1C59 YY[Bdjjn-44d;D1Dq!((D1C;? &&s{{3TA&T//0!4&&tyy1TA&T//0!4 a E2Eq!((E2ODBuQxL"R&1eAh4 [[]			"bAaD2b6* 	q2&Q#A.Aq!((A.b	: 	
RA.Aq!((A.@ 	q2&A.Aq!((A.d<a(i / /: 2 2 3 / /
 /s0   ^"^!^&^+^0^5^:^?c                V   t               }| j                  t              5  |j                  d       d d d        t	        j
                         }d|j                  _        | j                  t              5  |j                  |       d d d        t        j                         }|j                  |g       | j                  t              5  |j                  |g       d d d        t        j                         }|j                  d|       | j                  |j                  d       | j                  |j                  |d      d       | j                  t              5  |j                  |       d d d        y # 1 sw Y   IxY w# 1 sw Y   xY w# 1 sw Y   xY w# 1 sw Y   y xY w)Nr   r   r   T)returnSpecial)r   r   r   rS  r   r<   r   r   r   r  r@   r   r   r  )rB   r   r   rE   rG  s        rH   testStoreAtEndFailureszTest.testStoreAtEndFailures  s-   H/LLO 0 IIK#&

 /LLO 0 KKM	aS /LL! 0 [[]	BA&4@!D/LL 0/+ 0/
 0/ 0/ 0/s/   E94F	FF9FFFF(c                   t        j                         }d|_        t        j                         }d|_        t        j                         }t               }|j                  |       |j                  |       |j                  |       | j                  |D cg c]  }|j                   c}g d       |j                  d       | j                  |D cg c]  }|j                   c}g d       |j                  |d      }| j                  |D cg c]  }|j                   c}g d       |j                  |dd      }| j                  |D cg c]  }|j                   c}ddg       y	c c}w c c}w c c}w c c}w )
rO  r   r{   )r   rP  r  r3   )r        A@     K@r   rc  rd  N)r   r<   r   r   r  r   rW   rS  r   r   shiftElementsextractContext)rB   r   r   rF  r   r   rX  s          rH   testElementsHighestTimeBzTest.testElementsHighestTimeB  s;    YY[YY[[[]H			RA.Aq!((A.0AB 	
A.Aq!((A.0AB !!"b)F3Fq!((F35FG!!"a,F3Fq!((F3dD\B /
 / 4 4s   E/E4E9E>c                   t        j                         }d|_        t        j                         }d|_        t        j                  d      }t        j                         }t        j                         }t               }|j                  |       | j                  |D cg c]  }|j                   c}dg       |j                  |       |j                  |       |j                  |       | j                  |D cg c]  }|j                   c}g d       |j                  |       | j                  |D cg c]  }|j                   c}g d       | j                  |D cg c]  }|j                  d    c}g d       t        j                         }|j                  |       | j                  |D cg c]  }|j                  d    c}g d	       y c c}w c c}w c c}w c c}w c c}w )
Nr   r{   6/8r   )r   rP  rP  rP  )r   rP  r  r  r  r   )r<   r<   r  Treble8vaClefr;   )r<   r<   r  r  rj  r;   )r   r<   r   r   r;   r   r  r   rj  r   rW   r   r   rS  classes)	rB   r   r   ts1rF  r  r   r   rG  s	            rH   testElementsHighestTimeCzTest.testElementsHighestTimeC  s   YY[YY[!!%([[]!H	A.Aq!((A.6	R	R	SA.Aq!((A.0GH	A.Aq!((A.0MN21!))A,2V	X [[]	R21!))A,2a	c /
 / /2
 3s   G<G9G$%G)9G.c                &   t               t        j                         }d|_        t        j                         }d|_        t        j                         }d|_        t        j                         }d|_        ||||fD ]  }j	                  |        j                  dd      }| j                  |j                  D cg c]  }|j                  j                   c}g d       j                  d	d      }| j                  |j                  D cg c]  }|j                  j                   c}g d
       j                  dd      }| j                  |j                  D cg c]  }|j                  d u  c}g d       | j                  t        fd       j                  dd      }| j                  |j                  D cg c]  }|j                  j                   c}g d       j                  d|d      }| j                  |j                  D cg c]  }|j                  d u  c}g d       t               t        j                         }d|_        t        j                         }d|_        t        j                         }d|_        j	                  |       j	                  |       j	                  |       | j                  j                  d       j                         }|j                  d       | j                  |j                         j                  D cg c]  }|j                  j                   c}g d       |j                  dgd       | j                  |j                         j                  D cg c]  }|j                  j                   c}g d       t               t        j                  d      }d|_        t        j                  d      }d|_        t        j                  d      }d|_        t        j                  d      }d|_        ||||fD ]  }j	                  |        j                  dd      }| j!                  t#        d |j                  D                     t               t        j                         }d	|_        t        j                         }d|_        t        j                         }d|_        t        j                         }d|_        ||||fD ]  }j	                  |        j                  dd      }| j                  |j                  D cg c]  }|j                  d u  c}g d       y c c}w c c}w c c}w c c}w c c}w c c}w c c}w c c}w )Nr5   r6   r   r   r   Fr  )(rN   r  r  r  r  r  r  rO   rN   r  r  r  r  r  r  r  r  r  r  r  r  r  r  rO   rN   r  r  rO   rN   r  r  r  r  r  r  r  r  r  r  rO   r   )rN   r  r  rO   rN   r  r  r  r  r  r  rO   rN   rO   rN   r  r  r  r  rO   )
FFFFFFTFFFc                 *     j                  dd      S )Nrh  Fr  )sliceByQuarterLengths)r   s   rH   <lambda>z5Test.testSliceByQuarterLengthsBuilt.<locals>.<lambda>0  s    !"9"9%"9"OrJ   r  )rN   r  r  r  r  rO   rN   r  r  r  r  r  r  r  r  r  r  rO   rN   r  rO   rN   r  r  r  r  r  r  r  rO   )targetr  )TFFFFFFFFFFFFFFFFTTr   r  T)rN   rO   rN   rO   rN   rO   )0rN   r  r  r  r  r  r  r  r  r  r  r  r  r  r  rO   rN   r  r  r  r  r  r  r  r  r  r  r  r  r  r  rO   rN   r  r  r  r  r  r  r  r  r  r  r  r  r  r  rO   rp   r   r   r   c              3  8   K   | ]  }|j                   d u  y wr?  r%   r  s     rH   r  z6Test.testSliceByQuarterLengthsBuilt.<locals>.<genexpr>  s     J7I!AEE-7Is   )TTFFFFF)r   r   r<   r   rW   rp  r   r  r&   r2   r   r   r@  r  r  r   r   r  )	rB   r   r   r   r   r   ru  r  r   s	           @rH   testSliceByQuarterLengthsBuiltz#Test.testSliceByQuarterLengthsBuilt  s   HYY[YY[YY[YY[b"b!AHHQK " &&ue&<d.@.@A.@!%%**.@AF	G &&tU&;d.@.@A.@!%%**.@A:	; &&sE&:1C1CD1CA!%%4-1CD^	` 	/O	Q &&ue&<d.@.@A.@!%%**.@A^	_ &&uR&G1C1CD1CA!%%4-1CD&	' HYY[YY[YY[			+NN$	4(i.?.?.A.O.OP.O!%%**.OPL	N
 	''t'<!*!2!2!4!B!BC!BAQUUZZ!BC!		" HYYt_YYt_YYt_YYt_b"b!AHHQK " &&ue&< 	Jt7I7IJJKHYY[YY[YY[YY[b"b!AHHQK " &&sE&:1C1CD1CA!%%4-1CDH	Jq B B E B E8 Q Dd Es0    U+U0&U5
U:U?0VV	Vc                   t        j                  d      }t        j                  |      }|j                  D ](  }|j                  ddd       |j                  d       * | j                  t        |j                  d   j                         j                        d       | j                  t        |j                  d	   j                         j                        d       | j                  t        |j                  d
   j                         j                        d       | j                  t        |j                  d   j                         j                        d       t        j                  |      }|j                  D ](  }|j                  ddd       |j                  d       * | j                  t        |j                  d   j                         j                        d       | j                  t        |j                  d	   j                         j                        d       | j                  t        |j                  d
   j                         j                        d       | j                  t        |j                  d   j                         j                        d       t        j                  |      }|j                  ddd       | j                  t        |j                  d   j                         j                        d       | j                  t        |j                  d	   j                         j                        d       | j                  t        |j                  d
   j                         j                        d       | j                  t        |j                  d   j                         j                        d       y )Nbwv66.6r   TFr  addTiesr  r   r~  r5   r6   r7   r      )r   r   rX   rY   r   rp  r   r   r   r   r  )rB   sSrcr   rs   s       rH   !testSliceByQuarterLengthsImportedz&Test.testSliceByQuarterLengthsImported  s   ||I&MM$A##Cu#EKKK%  	QWWQZ//1??@"EQWWQZ//1??@"EQWWQZ//1??@"EQWWQZ//1??@"EMM$A##D$#FKKK%  	QWWQZ//1??@#FQWWQZ//1??@#FQWWQZ//1??@#FQWWQZ//1??@#F MM$	T5AQWWQZ//1??@"EQWWQZ//1??@"EQWWQZ//1??@"EQWWQZ//1??@"ErJ   c                t   t               }t        j                         }d|_        t        j                         }d|_        t        j                         }d|_        t        j                         }d|_        ||||fD ]  }|j	                  |        |j                  d      }| j                  t        |j                         j                        d       | j                  |j                  D cg c]  }|j                  j                   c}g d       t               }t        j                         }d|_        t        j                         }d	|_        t        j                         }d|_        t        j                         }d|_        ||||fD ]  }|j	                  |        |j                  d      }| j                  t        |j                         j                        d
       | j                  |j                  D cg c]  }|j                  j                   c}g d       y c c}w c c}w )Ng      ?r6   r   r   Fr     )rN   r  r  r  r  r  rO   rN   r  r  r  r  r  r  rO   rN   rO   rN   r  r  r  r  rO   rh  r  )rN   r  r  r  r  r  r  r  r  r  r  rO   rN   rO   rN   r  rO   rN   r  r  r  r  r  r  r  rO   )r   r   r<   r   rW   sliceByGreatestDivisorr   r   r   r  r&   r2   )rB   r   r   r   r   r   r   ru  s           rH   testSliceByGreatestDivisorBuiltz$Test.testSliceByGreatestDivisorBuilt  s   HYY[YY[YY[YY[b"b!AHHQK "'''6T\\^99:B?d.@.@A.@!%%**.@AR	S HYY[YY[ YY[YY[b"b!AHHQK "'''6T\\^99:B?d.@.@A.@!%%**.@AF	G) B( Bs   1H0H5c                v   t        j                  d      }|j                  D ]  }|j                  dd        | j	                  t        |j                  d   j                         j                        d       | j	                  t        |j                  d   j                         j                        d       | j	                  t        |j                  d   j                         j                        d	       | j	                  t        |j                  d
   j                         j                        d       y )Nrv  Trw  r   rH  r5   ;   r6   =   r7   r|  )r   r   r   r~  r   r   r   r  )rB   r   rs   s      rH   "testSliceByGreatestDivisorImportedz'Test.testSliceByGreatestDivisorImported  s    LL#A$$T4$@  	QWWQZ//1??@"EQWWQZ//1??@"EQWWQZ//1??@"EQWWQZ//1??@"ErJ   c                   t               }t        j                         }d|_        |j	                  |       |j                  g dd       |D cg c]  }|j                  |j                  f }}g d}| j                  ||       y c c}w )Nrn   )r5   r6   r7   Tr  )r   r   r   r   r   r   )r   r   )r   r   r<   r   rW   sliceAtOffsetsr   r   )rB   r   r   r   rC   rE   s         rH   testSliceAtOffsetsSimplezTest.testSliceAtOffsetsSimple  st    HIIK		D1234!Qahh(!4<A 5s   Bc                   t               }dD ]2  \  }}t        j                  |      }||_        |j	                  |       4 | j                  |D cg c]  }|j                   c}dg       |j                  g dd      }| j                  |D cg c]  }|j                  |j                  f c}g d       |j                  dgd      }| j                  |D cg c]  }|j                  |j                  f c}dd	g       t               }d
D ]2  \  }}t        j                  |      }||_        |j	                  |       4 | j                  |D cg c]  }|j                   c}g d       |j                  dgd      }| j                  |D cg c]  }|j                   c}g d       |j                  ddgd       | j                  |D cg c]  }|j                   c}g d       |j                  g dd       | j                  |D cg c]  }|j                   c}g d       | j                  |D cg c]  }|j                   c}g d       y c c}w c c}w c c}w c c}w c c}w c c}w c c}w c c}w )N))r   rn   r   )r   r5   r   r6   rY  r7   r  Fr  )r   r   )r   r   )r   r   )r   r   )r   r   )rY  r   )r   r   )r  r   r   r  )r   r  )a2r   r  r  )r   r   r   )r   r   r   r   r   rY  T)r   r   r   r   rY  r   )r   r   r  r   )	r   r   r   r   r   rY  r   r  r   )	r   r   r   r   r   r   r   r   r   )r   r   r<   r   rW   r   r   r  )rB   r   rs   rH  r   r   ri   s          rH   testSliceAtOffsetsBuiltzTest.testSliceAtOffsetsBuilt  sA   H EAr		!A AOHHQK ! 	A.Aq!((A.6;UKrBr!188Q__5rB>	? seU3rBr!188Q__5rBZQ[D\]H<EAr		!A AOHHQK = 	A.Aq!((A.@seU3B/Bq!((B/1EF
3*d3B/Bq!((B/1OP
.=B/Bq!((B/1^_262a!//26F	H1 / C
 C / 0//6s0   I"I'I,I1I6I;J Jc                   t        j                  d      }|j                  d   j                         j	                  g d      }| j                  |D cg c]  }|j                   c}g d       |j                  d   j	                  g d      }| j                  |j                  t              d   j                  D cg c]  }|j                   c}g d       | j                  |j                  t              d   j                  D cg c]  }|j                   c}g d       | j                  |j                  t              d	   j                  D cg c]  }|j                   c}g d
       y c c}w c c}w c c}w c c}w )Nrv  r   )r   r         
@)0r   r   r   r   r   r   r   r   r   r   r   r   r  r   r   r  r  r  r  r  r  r	  r  r  r  r  r  r  r  r        3@r   r  r  r        7@r        9@r        ;@      =@r  r       @@r       @A@rc  r  )r   r   r  g     A@)r   r   r   r5   )r   r   r   r   r  r   rP   )r   r   r   r   g      @)
r   r   r   r   r  r   r   r[  r   r  rB   rz  ru  r   s       rH   testSliceAtOffsetsImportedzTest.testSliceAtOffsetsImported  sj   ||I&zz!}$$&556HID1Dq!((D1\	] zz!}++,FG11':1=KKMK ()!((KM)	+ 	11':1=KKMK ()!((KM9	; 	11':2>LLNL ()!((LN4	6 2MMNs   E5?E:E?Fc                   t               }t        j                  d      }|j                  d|       dD ]2  \  }}t	        j
                  |      }||_        |j                  |       4 | j                  |D cg c]  }|j                   c}ddg       |j                         }| j                  |j                  D cg c]  }|j                  |j                  f c}g d       |j                  |       t        j                  d      }|j                  d|       |j                         }| j                  |j                  D cg c]  }|j                  |j                  f c}ddg       y c c}w c c}w c c}w )	Nr/   r   ))r   r7   r   )r  r  r  ri  )r   r   rE  )r   r   r;   r@   r   r<   r   rW   r   r   sliceByBeatr  r  )	rB   r   rl  rs   rH  r   r   ri   ts2s	            rH   testSliceByBeatBuiltzTest.testSliceByBeatBuilt4  sB   H!!%(	C EAr		!A AOHHQK !
 	A.Aq!((A.c
;]]_r?O?OP?O!188Q__5?OP=	? 	
!!%(	C]]_r?O?OP?O!188Q__5?OP$j1	3 / Q Qs   8E2>E7E<c                    t        j                  d      }|j                  d   j                         }| j	                  |j                         j                  D cg c]  }|j                   c}g d       y c c}w )Nrv  r   )'r   r   r   r   r   r   r   r  r  r  r  r  r	  r  r  r  r  r  r  r  r  r  r   r  r  r  r  r  r  r  r  r  rP  r  r  r  r  r  rc  )r   r   r   r  r   r   r  r   r  s       rH   testSliceByBeatImportedzTest.testSliceByBeatImportedK  sa    ||I&zz!}((*DLLN,H,HI,Hq!((,HID	EIs   A8c                   t        j                  d      }|j                  ddd      }| j                  |j                  d   j                         j                  D cg c]  }|j                   c}g d       |j                         }| j                  |j                         j                  D cg c]  }|j                   c}g d       | j                  t        |t        j                           d       y c c}w c c}w )	Nluca/gloriar   r{   F)gatherSpanners)8r   r   r  r  r   r  r&  r        !@r  r  r  r  r*       1@r  r'  r       3@r   r(  r  r  r  r  r  r  r  rP  r  r       A@r  r   r       C@r  r  r       E@     F@     F@     @G@     G@      H@     H@     I@     I@      J@     @J@     J@     J@      K@     K@     L@     @M@)Gr   r   r  r  r         @r  r&  r  r  r  r  r  r  r*  r  r  r'  r  r  r   r(  r  g     5@r  r  r  g     7@r  g     8@r  g     9@r  g     :@r  rP  r  r  r  r  r   r  r  r  r  r  r  r  r  r  g      G@r  r  g     G@r  r  r  r  r  r  r  r  r  g     @K@rd  r  g      L@g     @L@r  r  g     M@G   )r   r   r  r   r   r   r  r   r3  r   r   r   r  )rB   r   ru  r   s       rH   testChordifyImportedzTest.testChordifyImportedV  s    LL'zz!Rz6 	DJJqM,A,A,C,Q,QR,Qq!((,QR8	9 }} 	DLLN,@,@A,@q!((,@AQ	R 	T%++./4' S Bs   C<2Dc                	   t               }dD ]I  \  }}|t        j                         }nt        j                  |      }||_        |j                  |       K t               }dD ]I  \  }}|t        j                         }nt        j                  |      }||_        |j                  |       K | j                  |D cg c]  }|j                   c}g d       | j                  |D cg c]  }|j                   c}g d       t               }|j                  d|       |j                  d|       |j                  d   j                         }|j                  d   j                         }	| j                  t        |j                               d       | j                  t        |j                         j                  t        j                               d       | j                  t        |j                         j                  t        j                              d	       | j                  t        |	j                               d
       | j                  t        |	j                         j                  t        j                               d       | j                  t        |	j                         j                  t        j                              d       |j                         }
|
j                         }| j                  t        |j                         j                  t        j                               d       | j                  t        |j                         j                  t        j                              d	       |j                         }| j                  t        |j                         j                  t        j                               d       | j                  t        |j                         j                  t        j                              d	       | j                  t#        |j                  t        j                         j%                         j&                        d       | j                  t#        |j                  t        j                         d   j&                        d       y c c}w c c}w )N)ry  )r   r6   ry  )e3r6   )r{  r6   )ry  rw  )zd#3r5   ry  )e-5r6   ry  )r   r   r   r  r  )r   r   r   r   r  r  r   r5   r3   r7   r6   r   rn   z5(<music21.pitch.Pitch D2>, <music21.pitch.Pitch C#3>)z5(<music21.pitch.Pitch D2>, <music21.pitch.Pitch D#3>))r
   r   r  r<   r   rW   r   r   r	   r@   r   r3  r   r   r[  r   r  r   r  rN  )rB   r   rs   rH  r   r   r   scorep1Chordsp2Chords	scoreFlatscoreChordsscoreChordifys                rH   testChordifyRestszTest.testChordifyRestst  so   VLEAryIIKIIaL AOIIaL M VZEAryIIKIIaL AOIIaL [ 	B/Bq!((B/1JKB/Bq!((B/1OPQQ ;;q>**,;;q>**,X--/0!4X--/BB5;;OPRSTX--/BB499MNPQRX--/0!4X--/BB5;;OPRSTX--/BB499MNPQR MMO	((*[002EEekkRSUVW[002EEdiiPQSTU(]224GGTUWXY]224GG		RSUVW]==ekkJPPRZZ[P	R]==ekkJ1MUUVP	RA 0/s    R9,R>c                   t               }|j                  dt        j                  d             |j                  dt	        j
                  d             | j                  |j                  d       t               }|j                  t        j                  d      d       t               }|j                  d|       |j                  d|       |j                         }| j                  t        |j                  t        j                              d       | j                  t        |j                  t        j                        j!                         j"                        d       t               }|j                  dt        j                  d             |j                  dt	        j
                  d             | j                  |j                  d       t               }|j                  t        j                  dd	      d
       t               }|j                  d|       |j                  d|       |j                         }| j                  t        |j                  t        j                              d
       | j                  t        |j                  t        j                        j!                         j"                        d       y )Nr   r  rF  r   r  r  r  z4(<music21.pitch.Pitch C4>, <music21.pitch.Pitch G4>)r  r6   )r
   r@   r   r<   r   r  r   r@  r   r	   r3  r   r[  r   r  r   r  rN  )rB   r   r   r   ru  s        rH   testChordifyAzTest.testChordifyA  s   V
		!TYYT23
		$226:;.V
		$,G	B	Bzz|T44U[[ABBGT44U[[AGGIQQRO	Q V
		!TYYT23
		$226:;.V
		$c:A> G	B	Bzz|T44U[[ABAFT44U[[AGGIQQRO	QrJ   c                X   t               }t               }t        j                  d      |_        |j                  dt        j                                |j                          | j                  |j                  d       t               }|j                  t        j                         d       |j                  ||g       t               }t               }t        j                  d      |_        |j                  t        j                         d       |j                          | j                  |j                  d       t               }|j                  t        j                  d      d       |j                  ||g       t               }|j                  d|       |j                  d|       |j                         }| j                  t!        |j#                  t                    d       |j#                  t              j%                         }	| j                  |	j                  d       y )Nr   r   r   rn   r5   r  r6   )r
   r   r   r;   r   r@   r   r<   padAsAnacrusisr   paddingLeftr   rW   r  r	   r3  r   r[  r  )
rB   r   m1am2ar   m1bm2br   ru  r  s
             rH   testChordifyBzTest.testChordifyB  s   Vi!//6

1diik"#.ia(
		3*Vi!//6a(#.i4!,
		3*G	B	Bzz|T44W=>B$$W-335-rJ   c                   t        j                  d      }|j                  j                         j	                  t
              j                         }| j                  |j                  d       | j                  |j                  d       | j                  |j                  j                  d       | j                  |j                  D cg c]  }|j                   c}dg       |j                         }| j                  |j	                  t
              j                         j                  d       g }|j	                  t
              D ]E  }| j                  |j                                |j!                  t#        |j$                               G | j                  |g d       | j                  t#        |j'                         j	                  t(        j*                              d       yc c}w )zB
        Chordifies with triplets (floating point errors)
        zschoenberg/opus19/movement6r   r   r   )
r7   r)  r)  r  r  r  r  r   r     rn   N)r   r   r   r  r[  r   r   r@  r  r   r   r   r   r3  r   	hasVoicesrW   r   rN  r   r   r  )rB   r   r  r   ru  r  r   s          rH   testChordifyCzTest.testChordifyC  s^    LL67WW]]_//8>>@ 	--22C8BHH5Hq!((H5u=zz|009??AMMsS
 ((1AQ[[]+LLQYY( 2 	 DET\\^>>tyyIJAN 6s   G+c                   t               }|j                  t        j                  d      d       t               }|j                  t        j                  dd      d       t               }|j	                  d|       |j	                  d|       |j                         }| j                  t        |j                  t        j                              d       y )	Nr7   rF  rn   r  r6   r   r   r   )r   r   r   r<   r@   r3  r   r   r[  r   r  )rB   ri   rj   r  ru  s        rH   testChordifyDzTest.testChordifyD  s    X
		2A6X
		$a8!<X
		!R
		!R{{}T44U[[ABAFrJ   c                   t               }t               }t               }|j                  t	        j
                  dd      d       t               }|j                  t	        j
                  d      d       |j                  d|       |j                  d|       |j                  |       |j                         }| j                  t        |t        j                           d       y )	Nr  r   rF  r7   r5   r   r   r   )r   r   r   r   r   r<   r@   rW   r3  r   r   r   r  )rB   ri   r  r  r  ru  s         rH   testChordifyEzTest.testChordifyE  s    XYW
		$c:A>W
		2A6
		!R
		!R 			"{{}T%++./3rJ   c                   dd l }t        j                  d      }|j                  d      }| j	                  |j
                  j                  d       |j                  d      }| j	                  |j
                  j                  d       |j                  |j                  d            }| j	                  |j
                  j                  d       y )Nr   zessenFolksong/erk5blauenz"Ich sach mir einen blauen Storchenz	pfal.gr.fzEs fuhr sich ein PfalzgrafzPfal(.*))rer   r   getScoreByTitler   r   rA  compile)rB   r  r   r   s       rH   testOpusSearchzTest.testOpusSearch*  s    LL-.h'))+OPk*))+GHbjj45))+GHrJ   c                   t        t        t        t        j                                           }t        t        t        t        j                                           }t        ||g      }| j                  |j                  |      d       y)z{
        Providing a sequence of Scores to an Opus container should append
        rather than insert each at 0.0.
        r   N)r	   r
   r   r   r<   r   r   r  )rB   ri   rj   r   s       rH   testOpusSequencezTest.testOpusSequence6  s^    
 4		,-.4		,-."bN,c2rJ   c                x   t               }t               }|j                  |       | j                  |j                  |       |j	                  d      }| j                  |j                  |       |j	                         }| j                  |j                  |       |j	                         }| j                  |j                  |       |j	                  d      }| j                  |j                  |       |j
                  j                  t        j                        }| j                  |j                  |       |j
                  j                  t        j                        }| j                  |j                  |       |j                  t        j                        }| j                  |j                  |       y )NTretainContainers)r   rW   r   r
  r   r!   getObjByClassr   r;   r   r  r  )rB   outerinnerr   s       rH   testActiveSiteManglingzTest.testActiveSiteMangling@  sN   U))51}}d}3))51}}))51 }}))51
 }}d}3))51 {{(()<)<=))51{{((3))51&&tyy1))51rJ   c                \   t        j                  d      }|j                  D ]  }|j                  t              D ]  }|j
                  d   }|j                  t        j                        }| j                  t        |t        j                        |       |j                  t        j                        }| j                  t        |t        j                        |       |j                  t        j                        }| j                  t        |t        j                        |        
 y )Nrv  r   )r   r   r   r[  r   r   r  r   r  r   r  r   r;   r   r=  )rB   r   rs   r   r   ru  s         rH   testGetElementsByContextStreamz#Test.testGetElementsByContextStreama  s    LL#A))'2GGAJ**4995
4 ;TB**5+>+>?
41D1D EtL**3+;+;<
41A1A BDI 3 rJ   c                   t               }t        j                  d      }d|_        |j	                  |d       t               }t        j                  d      }d|_        |j	                  |d       t               }|j                  d|       |j                  d|       |j                         }| j                  t        j                  t        |      d             t               }|j                  d|       | j                  t        |d   j                        d       | j                  |d   j                  d   D cg c]  }|j                    c}g d	       | j                  |d   j                  d   D cg c]  }|j                    c}d
dg       t#        j$                         }	|	j'                  |      j)                  d      }
y c c}w c c}w )Nr  r   rn   r  r5   r6   r   a"  [OffsetMap(element=<music21.note.Note D>, offset=0.0, endTime=0.5, voiceIndex=0),
            OffsetMap(element=<music21.note.Note D>, offset=0.5, endTime=1.0, voiceIndex=0),
            OffsetMap(element=<music21.note.Note D>, offset=1.0, endTime=1.5, voiceIndex=0),
            OffsetMap(element=<music21.note.Note D>, offset=1.5, endTime=2.0, voiceIndex=0),
            OffsetMap(element=<music21.note.Note C>, offset=0.0, endTime=1.0, voiceIndex=1),
            OffsetMap(element=<music21.note.Note C>, offset=1.0, endTime=2.0, voiceIndex=1)]r  r   r   rg  )r   r   r<   r   r   r   r@   	offsetMapr   r   whitespaceEqualr  r
   r   r   r  r   r*   rh  r   ri  )rB   r  r   r  r   r   oMap	oMeasuresr   rj  rk  s              rH   testVoicesAzTest.testVoicesAn  s   WYYt_
AWYYt_
AI	B	B {{}..J`a 	b F	AYq\00115IaL,?,?,BC,Bq!((,BC-	/IaL,?,?,BC,Bq!((,BCs	% ,,.IIaL''0	 DCs    G<Gc                   t               }t        j                  d      }d|_        |j	                  |d       t               }t        j                  d      }d|_        |j	                  |d       t               }t        j                  d      }d|_        |j	                  |d	       t               }t        j                  d
      }d|_        |j	                  |d       t               }	|	j                  d|       |	j                  d|       |	j                  d|       |	j                  d|       |	j                         }
t        d      D ]*  }| j                  t        |
|   j                        d       , t        d      D ]8  }| j                  t        |
|   j                         j                        d       : t        d      D ]  }| j                  t        |
|   j                  d   j                        d       | j                  t        |
|   j                  d   j                        d       | j                  t        |
|   j                  d   j                        d       | j                  t        |
|   j                  d   j                        d        t        j                         }|j!                  |
      j#                  d      }y )Nrx  r       r  r5   r   r   r   @   r  rn   r   r7   r  r   r6   rg  )r   r   r<   r   r   r
   r@   r  rV   r   r   r  r   r  r*   rh  r   ri  )rB   r  r   r  r   v3r   v4r   r   r  ra   rj  rk  s                 rH   testVoicesALongerzTest.testVoicesALonger  s;    WYYt_
BWYYt_
BWYYt_
BWYYt_
AF	B	B	B	BNN$	 qAS1!4!45q9  qAS1!5!5!7!E!EFK  qAS1!4!4Q!7!E!EFJS1!4!4Q!7!E!EFJS1!4!4Q!7!E!EFKS1!4!4Q!7!E!EFJ	  ,,.IIi(//8	rJ   c                (   t               }t        j                  d      }d|_        |j	                  |d       t               }t        j                  d      }d|_        |j	                  |d       t               }t        j                  d      }d|_        |j	                  |d	       t               }|j                  d
|       |j                  d
|       |j                  d
|       |j                         }| j                  t        |j                  t                    d       | j                  t        |j                  t              d
   j                        d       | j                  t        |j                  t              d   j                        d       | j                  t        |j                  t              d	   j                        d       | j                  t        |j                  t              d   j                        d
       y )Nrx  r      r  r7   r   r   r   rn   r   r5   r6   r3   )r   r   r<   r   r   r   r@   r  r   r   r[  r   r  )	rB   r  r   r  r   r  r   r   rI  s	            rH   testVoicesBzTest.testVoicesB  s    WYYt_
BWYYt_
AWYYt_
AH	B	B	B U55g>?CU55g>qAHHI1MU55g>qAHHI1MU55g>qAHHI1MU55g>qAHHI1MrJ   c                Z   t               }t        j                  d      }d|_        |j	                  |g d       t               }t        j                  d      }d|_        |j	                  |g d       t               }|j                  d|       |j                  d|       |j                  dd	      }| j                  t        t        |j                  d   j                              d
       | j                  t        t        |j                  d   j                              d       y )Nrx  r   )r6   r  g      @r  r  )r   r  r  g     +@r   TF)r  r  z[<music21.note.Rest half>, <music21.note.Note C>, <music21.note.Rest 2.25ql>, <music21.note.Note C>, <music21.note.Rest 2.5ql>, <music21.note.Note C>, <music21.note.Rest 4.25ql>, <music21.note.Note C>, <music21.note.Rest half>]r5   z[<music21.note.Rest 16th>, <music21.note.Note C>, <music21.note.Rest 3.25ql>, <music21.note.Note C>, <music21.note.Rest dotted-quarter>, <music21.note.Note C>, <music21.note.Rest breve>, <music21.note.Note C>])r   r   r<   r   r>   r   r@   r  r   r   r   r  r  )rB   r  r   r  r   r   rI  s          rH   testVoicesCzTest.testVoicesC  s    WYYt_
12WYYt_
45H	B	BT59T%,,q/"?"?@A7	8 	T%,,q/"?"?@AO	PrJ   c           	        t        j                  d      }|j                  d      }| j                  t	        |j
                        d       |j
                  d   }| j                  t	        |j                         j                  t        j                              d       |j                  t              d   }| j                  t	        |j                               d       |j                  t              d   }| j                  t	        |j                               d       |j                  t              d   }| j                  t	        |j                               d       |j                  t              d   }| j                  t	        |j                               d       |j                  dd      }| j                  t	        |j                         j                  t        j                              d       |j
                  D ]  }| j                  t	        |j                  t              j                         j                        d       | j                  t	        |j                  d      j                        d       | j                  t	        |j                  dd      j                  t              d   j                        d        y )Nrv  r6   r   r5   r   r)  r7   )r   r   partsToVoicesr   r   r   r   r[  r   r  r   r  r  r  r[  )rB   r,  ri   r   m1Rawm2Rawex1rs   s           rH   testPartsToVoicesAzTest.testPartsToVoicesA  s   \\)$a  	RXX*XXa[RZZ\<<TYYGH!L
 %%g.q1U]]_-q1 %%g.q1U]]_-q1 %%g.q1U]]_-q1 %%g.q1U]]_-q1
 kk!QS[[]==diiHI1M AS!5!5g!>!D!D!F!M!MNPQRS1!4!45q9S1"((1!"55;V=>?A	 rJ   c                4   t        j                  d      }| j                  t        |j                        d       |j                  dd      }| j                  t        |j                        d       | j                  t        |j                  d   j                  t              j                         j                        d       | j                  t        |j                  d   j                  t              j                         j                        d       y )NrP  r7   r6   TpermitOneVoicePerPartr   r5   )
r   r   r   r   r   r  r[  r   r  r  )rB   r,  ri   s      rH   testPartsToVoicesBzTest.testPartsToVoicesBB  s    \\34RXX*at<RXX*RXXa[;;GDJJLSSTVWXRXXa[;;GDJJLSSTVWXrJ   c                	   t        j                         }t        j                         }t        j                  d      }t        j                  d      }t	               }t	               }t        j                  dd      }t        j                  dd      }t        j                  dd      }	t        j                  dd      }
t        j                  dd      }t        j                  dd      }t        j                  dd      }t        j                  dd      }|j                  ||t        j                  d      ||t        j                  d      |	|
t        j                  |	|
      t        j                  d	d
g      t        j                  d      t        j                  d
dg      t        j                  d      f       t        j                  d      |_        |j                  ||t        j                  ddg      t        j                  d      t        j                  ddg      t        j                  d      t        j                  d      ||t        j                  d      ||f       t        j                  d      |_        t!               }|j                  |       |j                  t        j                  ||             t!               }|j                  t        j                  ||             |j                  t        j                  ||             |j                  |       t#               }|j%                  d|       |j%                  d|       |j'                  dd      }| j)                  t+        |      d       | j)                  t+        |d   j-                  d            d       | j)                  t+        |d   d         d       | j)                  t+        |d         d       | j/                  |d   d   t               | j)                  |d   d   d   |       | j)                  |d   d   d   |       | j)                  t+        |d   d   j0                        d       | j)                  t+        |d   d   d   d         d       | j)                  |d   d   d   d   d   d   |	       | j)                  |d   d   d   d   d   d   |
       y )Nz12/8C#5rM   r1   r  A5zB-5C6rC  rG  r  re   r^  r  r   r6   Tr  r5   r$  r7   rn   )r   r<  r   r;   r   r   r<   rW   r  r"   r$  r   r  r   r  r  r
   r	   r@   r  r   r   r[  rV  r  )rB   clef1clef2rl  r  r  r	  r   r   r   r   r  rD  n7n8r   r   r   s_s                      rH   testPartsToVoicesSpannerzTest.testPartsToVoicesSpannery  s   !!!!&)!!&)YYYYu8,YYt(+YYt(+YYu8,YYt(+YYu8,YYt(+YYu8,
		3		x0"bII8$b"LLR KKt%tyyh'?KKu&		x(@
 	 ++i0
		3T4L1499(3KKKt%tyyh'?II8$b"II8$b"	
 	 ++i0V
		"
		',,r2&'V
		',,r2&'
		',,r2&'
		"G	B	B__Qd_;R!$RU55f=>BRU6]+Q/RUQ'beAh0Aq!e,Aq!c*RU1X__-q1RU1Xa[0115Aq!V,Q/2B7Aq!V,Q/2B7rJ   c           	     L   t        j                  d      }|j                  d      }|j                  d   j	                         }| j                  t        |j                        d       | j                  t        |j                  d   j                         j                        t        |j                  d   j                         j                               |j                  d      }| j                  |j                  d   d       | j                  t        |j                  d   j                  t              j                         j                        d       |j	                         }| j                  t        |j                  d   j                         j                        t        |j                  d   j                         j                               | j                  t        t        |j                  d   j                         j                              t        t        |j                  d   j                         j                                     | j                  t        |j                  d   j                         j                        t        |j                  d   j                         j                               | j                  t        t        |j                  d   j                         j                              t        t        |j                  d   j                         j                                     | j                  t        |j                  d   j                         j                        t        |j                  d   j                         j                               | j                  t        t        |j                  d   j                         j                              t        t        |j                  d   j                         j                                     | j                  t        |j                  d   j                         j                        t        |j                  d   j                         j                               | j                  t        t        |j                  d   j                         j                              t        t        |j                  d   j                         j                                     t!               }t#               }|j%                  t'        j(                  d      d       t#               }|j%                  t'        j(                  d	      d       t#               }|j%                  t'        j(                  d
      d       |j+                  d|       |j+                  d|       |j+                  d|       |j	                         }| j                  t        |j                        d       | j                  t        |j                  d   j                               t        |j                                      | j                  t        |j                  d   j                               t        |j                                      | j                  t        |j                  d   j                               t        |j                                      | j                  t        |j                  d   j                               t        |j                                      | j                  t        |j                  d   j                               t        |j                                      y )Nrv  r6   r   rn   r	   r5   r7   r   r  b5)r   r   r  r   voicesToPartsr   r   r   r  rk  r[  r   r  r  r   r   r   r   r   r   r<   r@   )rB   r,  ri   rj   r  r  r  s          rH   testVoicesToPartsAzTest.testVoicesToPartsA  s=   \\)$a XXa[&&(RXX*RXXa[002@@ARXXa[002@@A	C a A0RXXa[;;GDJJLSSTVWXRXXa[002@@ARXXa[002@@A	CT"((1+"5"5"7"E"EFGT"((1+"5"5"7"E"EFG	I 	RXXa[002@@ARXXa[002@@A	CT"((1+"5"5"7"E"EFGT"((1+"5"5"7"E"EFG	I 	RXXa[002@@ARXXa[002@@A	CT"((1+"5"5"7"E"EFGT"((1+"5"5"7"E"EFG	I 	RXXa[002@@ARXXa[002@@A	CT"((1+"5"5"7"E"EFGT"((1+"5"5"7"E"EFG	I
 XW
		$+W
		$+W
		$+
		!R
		!R
		!RRXX*bhhqk1134d2::<6HIRXXa[0023S5FGbhhqk1134d2::<6HIRXXa[0023S5FGbhhqk1134d2::<6HIrJ   c                   t        j                  d      }t        j                  d      }t	        j
                  d      }t	        j
                  d      }t               }t               }|j                  ||t        j                  d      f       ||_        t               }t               }t               }	|j                  t        j                  d             |	j                  t        j                  d             |j                  d|       |j                  d|	       ||_        |j                  ||f       |j                         }
|
j                  D ]  }|j!                         }| j#                  ||       | j#                  ||       | j%                  |j'                  t              d   j                         | j%                  |j'                  t              d   j                          y )	Nr   rf   r  rr  r   r1   r   r5   )r   r  r   r;   r   r  r	   r   rW   r   r<   r  r   r@   r  r   r   r   r  r[  )rB   r  rD   rF  rG  r   r  r	  r  r  	partScorer  flattenedParts                rH   *testVoicesToPartsNonNoteElementPropagationz/Test.testVoicesToPartsNonNoteElementPropagation  sg   GGCL  '[[#[[!GY
		1b$))012YWW
		$))()
		$))()
		!R
		!R	"bOO%	OOD LLNMMM!]+MM"m,  !8!8!A!!D!Q!QR  !8!8!A!!D!Q!QR $rJ   c                   t               }t               }t               }t        j                  d      }t        j                  d      }|j                  |       |j                  |       |j	                  |       | j                  t        |      d       | j                  t        |d         t        |d                | j                  t        |d         t        |d                |j	                  |dg       | j                  t        |      d       |j	                  |dg       | j                  t        |      d       y )	Nr   ro   r6   r   r5   r  )classFilterListr   )r   r   r<   rW   mergeElementsr   r   r   )rB   ri   rj   r  r   r   s         rH   testMergeElementszTest.testMergeElements  s    XXXYYt_YYs^
		"
		"
R!$BqEBr!uI.BqEBr!uI.
fX6R!$
m_=R!$rJ   c                   t        j                         }t        j                  d      }t        j                  d      }d|_        t        j                  ||      }t               }|j                  |       |j                  |d       |j                  |       |j                  |       | j                  |j                  d   |j                  d   j                                | j                  |j                  d   |j                  d   j                                t        j                  |      }| j                  t!        |j                        d       | j                  |j                  d   |j                  d   j                                | j                  |j                  d   |j                  d   j                                | j                  t!        |j                        d       | j                  |j                  d   |j                  d   j                                | j                  |j                  d   |j                  d   j                                | j                  |j                  d   j                         |j                  d   |j                  d   g       t#        j$                         }|j'                  |      j)                  d      }y )	NrV  r   r   rn   r   rP   r5   rg  )r   r<   r   r"   r$  r   rW   r   r@   r   r  r&  getSpannedElementsrX   rY   r   r   r*   rh  r   ri  )	rB   r   r   r   su1ri   rj   rj  rk  s	            rH   testDeepcopySpannerszTest.testDeepcopySpanners&  s   YY[YYt_YYull2r"X
		"
A
		"
		#b&&q)2;;q>+L+L+NOb&&r*BKKN,M,M,OP]]2 	R[[)1-b&&q)2;;q>+L+L+NOb&&r*BKKN,M,M,OP 	R[[)1-b&&q)2;;q>+L+L+NOb&&r*BKKN,M,M,OPQ::<**1-r/?/?/CD	F ,,.IIbM((1	rJ   c                   t        j                  d      }|j                  d   }d }d }|j                         j                  }|d   }t        |      D ]  \  }}|t        |      dz
  k  r	||dz      }	n!|j                  r|}n#||	j                  r|j                  |}n|	|u r|}|V|Y|j                  t        j                  ||             d }d } |j                         i }
|j                  D ]  }|j                         }t        fd|j                         D              }t        fd|j                         D              }||z
  }|j                   }||
vrg |
|<   |
|   j#                  |        t%        t'        |
j)                                     D ]  }t+        |
|         t        |
|         z  }! y )Nr  r   rP   r5   c              3  @   K   | ]  }j                  |        y wr?  r  r  r   exFlats     rH   r  z,Test.testAddSlurByMelisma.<locals>.<genexpr>k       P8O1v++A.8O   c              3  @   K   | ]  }j                  |        y wr?  r   r!  s     rH   r  z,Test.testAddSlurByMelisma.<locals>.<genexpr>l  r#  r$  )r   r   r   r   r  r  r   lyricsr&   r@   r"   r$  r&  getFirstminr  beatStrrW   r   r   r  sum)rB   r   rk  nStartnEndexFlatNotesnLastra   r   nNextmelismaByBeatspoMinoMaxr8  r)  
unused_avgr"  s                    @rH   testAddSlurByMelismazTest.testAddSlurByMelismaJ  s   LL'WWQZjjl00Bk*DAq3{#a''#AE*xx#%!d&6		',,vt45% +( ++BAP8M8M8OPPDP8M8M8OPPD+CiiGm+)+g&'"))#.  d=#5#5#789G]734s=;Q7RRJ :rJ   c                `    t               }|j                  t        j                  d             y )ND#4)r
   rW   r   r<   r  s     rH   testTwoZeroOffsetzTest.testTwoZeroOffsety  s    F	5!"rJ   c                B   t               }|j                  t        j                  d             |j                  t	        j
                  d             |j                  t	        j
                  d             |j                  t	        j
                  d             |j                  t	        j
                  d             |j                  t	        j
                  d             |j                         }| j                  t        |j                         j                        d       | j                  t        |j                         j                  D cg c]  }|j                   c}      d       | j                  |j                         j                  D cg c]  }|j                   c}g d       |j                         }| j                  t        |j                         j                  D cg c]  }|j                   c}      d       | j                  |j                         j                  D cg c]  }|j                   c}g d	       |j                  t               j#                         j                  }| j                  |D cg c]  }|j$                   c}g d
       | j                  |D cg c]  }|j                   c}g d       | j                  |D cg c]  }|j&                   c}g d       | j                  |j                  t               d   j                  D cg c]  }|j$                   c}ddg       | j                  |j                  t               d   j                  D cg c]  }|j                   c}ddg       | j                  |j                  t               d   j                  D cg c]  }|j&                   c}ddg       y c c}w c c}w c c}w c c}w c c}w c c}w c c}w c c}w c c}w c c}w )Nr   r0   r1   r   r   zI[None, None, <music21.tie.Tie start>, <music21.tie.Tie stop>, None, None])r   r   r   r   r   r   z[None, None, None, None, None])r   r   r   r   r   )r   r   r   )r   r   r   )124r5   r   r   r   r;  r<  )r   rW   r   r;   r   r<   r  r   r   r   r  r   r&   r   r  r[  r   r  r   r)  )rB   ri   rj   r   r  first_m_notesAndRestss         rH   testStripTiesBuiltBzTest.testStripTiesBuiltB  sP   X
		%%%e,-
		$))+,
		$))()
		$))()
		$))()
		$))+,__RZZ\778!<RZZ\-G-GH-Gaee-GHIA	B 	2::<3M3MN3Ma!//3MN7	9 \\^RZZ\-G-GH-Gaee-GHI9	;2::<3M3MN3Ma!//3MN2	4 !# 5 5g > D D F T T,AB,Aq!((,AB(	*%:<%: //%:<(	* 	-BC-B!))-BC(	* 	!44W=a@NNON!QXXNO#J	 	&(&;&;G&DQ&G&U&UV&UQ__&UV#J	 	 " 5 5g >q A O OP O1QYY OP#J	7 I O IN C< D P W Qs<   O/O46O9<O>PP-P9PPPc                R   t        j                  d      }|j                  d   }|j                  t              }| j                  |d   j                  D cg c]  }|j                   c}dg       | j                  t        |d   j                  D cg c]  }|j                   c}      d       | j                  |d   j                  D cg c]  }|j                   c}ddg       | j                  t        |d   j                  D cg c]  }|j                   c}      d       |j                  d	
      }|j                  t              }| j                  |d   j                  D cg c]  }|j                   c}dg       | j                  t        |d   j                  D cg c]  }|j                   c}      d       | j                  |d   j                  D cg c]  }|j                   c}dg       | j                  t        |d   j                  D cg c]  }|j                   c}      d       | j                  |d   j                  D cg c]  }|j                   c}g d       y c c}w c c}w c c}w c c}w c c}w c c}w c c}w c c}w c c}w )Nzmonteverdi/madrigal.4.2.xmlz#Altor7   r   z[<music21.tie.Tie start>]rn   r   z[None, None]TrM  z[None]r3   )r   r   r   r   r   r   )r   r   r   r[  r   r   r  r   r   r&   r  )rB   sMonteri   r   r   rj   s         rH   testStripTiesImportedBzTest.testStripTiesImportedB  sB    ;<\\'"''0GAJ,D,DE,Dq!((,DEuMWQZ-E-EF-Eaee-EFG4	6GAJ,D,DE,Dq!((,DESzRWQZ-E-EF-Eaee-EFG'	) \\t\,''0GAJ,D,DE,Dq!((,DEuMWQZ-E-EF-Eaee-EFGRGAJ,D,DE,Dq!((,DEuMWQZ-E-EF-Eaee-EFGRGAJ,D,DE,Dq!((,DE7	9! FFEF FFEFEs6   I<JJJ.J+J&J#JJ$c                   t               }|j                  t        j                         d       |j                  t	        j
                         d       t               }|j                  j                         }| j                  t        |      d       | j                  |j                  j                  |       | j                  |j                  j                  |       |j                  t        j
                        j                         }| j                  t        |      d       | j                  |j                  j                  |       t        j                   d      }|j"                  d   }| j                  |j                  j                  d        |j%                         }| j                  |j%                         j                  j                  |       | j                  |j%                         j                  j                  |       |j                  j                         }| j                  |j                  j                  |       | j                  |j                  j                  |       | j                  t'        |j                  j)                               ||g       | j                  |j%                         j                  j                         j                  j                  j                  j                  |       | j                  |j%                         j                  j                         j                  j*                  |       | j                  |j                  t,              d   j%                         j                  j                         j                  j*                  |       | j                  |j                  t,              d   j%                         j                  j                         j                  j*                  |j                  t,              d          |j/                  d      }	| j                  |	j%                         j                  j                         j                  j*                  |	t'        |	j%                         j                  j                         j                  j)                                      |j1                  dd      }
| j                  |
j                  j*                  |       | j                  |
j%                         j                  j                         j                  j*                  |       | j                  |j%                         j                  t        j2                        j                         j                  j*                  |       | j                  |j                  t,              d   j4                  |       y )Nry   r{   rB  r   r7   rn   r   )r   r   r   r<   r   r  r  r  r   r   r  r2  originr)  r[  r   r   r   r   r   r3  rootDerivationr   r[  r  r  r
  )rB   ri   rj   r  r  r   r   p1Flatp1FlatNotesm4mRanges              rH   testDerivationAzTest.testDerivationA  s   X
		R(
r* X$$&R"%bmm**B/--r2""5;;/668R"%bmm**B/ LL(WWQZ--t4bjjl--44b90077;**113k,,33V<//66;k44::<=|L 	bjjl00779DDKKVV]]_ab 	bjjl00779DDSSUWX 	..w7:BBDRRYY[$*^^	
 	b++G4Q7??AOOVVX!z..++G4Q7	9 ZZ]bjjl00779DDSSUWRZZ\77>>@KKQQST	V Q"**992>)77>>@KKZZ\^_IIK**4995<<>IIXX	
 	b++G4Q7BBBGrJ   c                N   t               }|j                  t        j                         d       |j	                         }| j                  |j                  j                  |       | j                  |j                  j                  |       t        j                  |      }| j                  |j                  j                  |       | j                  |j                  j                  j                  j                  |       | j                  |j                  j                  |       y )Nry   )r   r   r   r<   r   r  r2  rC  _derivationclientrX   rY   )rB   ri   r  rj   s       rH   testDerivationBzTest.testDerivationB  s    X
		R(f''..3f((//8]]6"bmm**F3bmm**55<<bAbnn++R0rJ   c                0   t        j                  d      }|j                  d   }|j                  dd      }|j	                         }|j
                  j                         }| j                  t        |j                  j                               |||g       y )NrB  z#Sopranor7   ry   )r   r   r   r  r   r  r  r   r   r2  r3  )rB   r   r   	pMeasurespMeasuresFlatpMeasuresFlatNotess         rH   testDerivationCzTest.testDerivationC  s    LL(WWZ KK2&	!))+*88??A0;;AACD'B7	9rJ   c                   t               }|j                  t        j                         d       |j	                         }| j                  |j                  j                  |       | j                  |j                  j                  d       |j                  t        j                        j                         }| j                  |j                  j                  d       t        j                  d      }|j                         }| j                  |j                  j                  d       |j                  d      }| j                  |j                  j                  d        y )Nry   r   r[  ztinyNotation: 4/4 C2 D2r  r5   )r   r   r   r<   r   r  r2  rC  r   methodr[  r  r   r   r  r[  )rB   ri   r  
s1Elementss1ms1m1s         rH   testDerivationMethodAzTest.testDerivationMethodA$  s    X
		R(f''..3**119=..tyy9@@B
..557KL__67oo..?{{1~//6rJ   c                   t        j                  d      }| j                  |d   d   d   j                         D cg c]  }t	        |j
                         c}g d       |j                         j                  d   }| j                  |j                         D cg c]!  }t        j                  |j
                        # c}ddg       y c c}w c c}w )NrB  r5   r6   r7   )z%<class 'music21.stream.base.Measure'>z"<class 'music21.stream.base.Part'>z#<class 'music21.stream.base.Score'>r   r	   )
r   r   r   containerHierarchyr   	__class__r   r  r   classToClassStr)rB   r   r   r   s       rH   testContainerHierarchyAzTest.testContainerHierarchyA4  s    LL(AaDGAJ4Q4Q4ST4Sq#akk*4STA	B IIK%%a(qG[G[G]^G]!&00=G]^!7+	- U _s   C&Cc                    t               }|j                  t        j                  dd             |j                  t        j                  dd             |j                  t        j                  dd             |j	                         }| j                  t        |d   j                        d       | j                  t        |j                         j                  t        j                              d       |j                  dt        j                  d	             | j                  t        |j                         j                  t        j                              d
       |j	                         }| j                  t        |d   j                        d       | j                  |j                         | j                  t        |j                         j                  t        j                              d
       y )Nrd   r0   r1   re   rC  r   r  r   rf   r5   z!<music21.meter.TimeSignature 2/4>)r   rW   r   r<   r  r   r   r   r   r   r[  r   r;   r@   r   r   )rB   rz  r  sMeasuresTwoFours       rH   testMakeMeasuresTimeSignaturesz#Test.testMakeMeasuresTimeSignaturesD  sr   xDIId34DIId34DIId34%%'	Yq\778<	> 	T\\^>>u?R?RSTVWXC,,U34T\\^>>u?R?RSTVWX,,.-a0>>?<	>(112 	$$&99%:M:MNPQR	TrJ   c                   t               }t        j                         }|j                  |       | j	                  t        |j                        t        |             t        j                  |      }|d   }| j	                  t        |j                        t        |             t               }t               }t        j                         }|j                  |       |j                  |       | j	                  t        |j                        t        |             | j	                  t        |j                        t        |             t        j                  |      }|d   }|d   }| j	                  t        |j                        t        |             | j	                  t        |j                        t        |             t        j                  d      }|j                  t              j                         }|j                         j                  t              d   }|d   }| j	                  t        |j                        t        |             | j	                  t        |j                        t        |             | j	                  t        |j                        t        |             t        j                  |      }|d   }	|	d   }|d   }
| j	                  t        |
j                        t        |             | j	                  t        |j                        t        |	             | j	                  t        |	j                        t        |             y )Nr   rv  r6   r5   )r   r   r<   rW   r   r   r
  rX   rY   r   r   r   r[  r
   r  iter)rB   r   r   ri   r   r   r  rs   rnr   rn1s              rH   testDeepcopyActiveSitezTest.testDeepcopyActiveSite^  sY   HIIK	ALL)2a51 ]]1UBMM*BrF3HIIIK		ALL)2a51ALL)2a51]]1UUBMM*BrF3BMM*BrF3 LL#  &,,.FFH''03qTBMM*BqE2ALL)2a51ALL)2a51]]1UUeCNN+RV4BMM*BrF3BMM*BrF3rJ   c                    t        j                  d      }t        |j                  d            }| j	                  ||v        | j                  t        |      d       y )Nrv  T)r`     )r   r   r   r   r   r   r   )rB   r   	rElementss      rH   testRecurseAzTest.testRecurseA  sI    LL#t45	Y'Y-rJ   c                
   t        j                  d      }| j                  t        |d         d       |j	                  d      D ]  }|j
                  j                  |        | j                  t        |d         d       y )Nzmadrigal.5.8.rntxtr=  r5   classFilterr   )r   r   r   r   r   r
  r  rB   r   r   s      rH   testRecurseBzTest.testRecurseB  sl    LL-.Q~./3~6ALL" 7Q~./3rJ   c                0   t        j                  d      }|j                  d   }|j                         j                  d   }|j                  dd      }| j                  t        |      d       | j                  t        |      d       |j                  dd      }| j                  t        |j                         j                  d         d       | j                  t        |j                         j                  d         d       |j                         j                  dd      }| j                  t        |j                         j                  d         d       | j                  t        |j                         j                  d         d       y )Nrv  r   P4Fr  r  r  )r   r   r   r   r  r  r   r   )rB   r   r   pitch1pitch2r   s         rH   testTransposeScorezTest.testTransposeScore  s=   LL#WWQZ++A.!!$!6V&>?V&>? \\$\.RZZ\77:;=UVRZZ\77:;=UVZZ\##D%#8RZZ\77:;=UVRZZ\77:;=UVrJ   c                n    ddl m} t        j                  |j                        }|j                         }y )Nr   )	testFiles)r  ru  r   r   schumannOp48No1r   )rB   ru  rC   unused_bs       rH   testExtendDurationAzTest.testExtendDurationA  s$    .OOI55699;rJ   c                   t        j                  d      }|j                  d   j                  dd      }|j	                  t
        j                        }| j                  t        |      d       |d   j                         D cg c]  }t        |       }}|d   j                         D cg c]  }t        |       }}y c c}w c c}w )NrP  r   r3   ry   r5   )r   r   r   r  r[  r"   r$  r   r   r  r   )rB   r   ru  
rbSpannersr   unused_firstSpannedElementIdsunused_secondSpannedElementIdss          rH   testSpannerTransferAzTest.testSpannerTransferA  s    LL23wwqz""1b),,W\\:
Z!,8B18X8X8Z([8Z1A8Z%([9CA9Y9Y9[)\9[A"Q%9[&)\ )\)\s   C-Cc                      fd}t        j                  d      } ||       t        j                  d      } ||       y )Nc                F   g }| j                   D ]E  }|j                  t              d   j                  }|j	                  |j                  d|             G |D ]E  }|j                  t              D ]+  }j                  |j                         j                         - G y )NrP   r   )	r   r[  r   r  rW   r  r   r   r  )piecevoicesMeasuresr  mMaxvoicemeasrB   s         rH   parseMeasuresz/Test.testMeasureGrouping.<locals>.parseMeasures  s    N ..w7;BB %%dmmAt&<= $ (!44W=D OODLLN$@$@A > (rJ   rP  zbach/bwv7.7)r   r   )rB   r  corellibachs   `   rH   testMeasureGroupingzTest.testMeasureGrouping  s8    	B( ,,89g||M*drJ   c                   t               }|j                  t        j                  dd      d       |j                  t        j                  dd      d       |j	                  d	       | j                  |j                  D cg c]!  }t        |j                  j                        # c}g d
       | j                  |j                  d d D cg c]"  }|j                  j                  j                  $ c}g d       t        j                         }|j                  |      j                  d      }| j                  |j!                  d      dkD  |       | j#                  |j!                  d      d|       y c c}w c c}w )Nrp   r   rF  rn   rg   rh  r   Tr  )
rg  rg  rg  rg  naturalr  r  r  r  r  r3   )TFFFTrg  z@<tuplet bracket="yes" number="1" placement="above" type="start">r   <beam number="1">begin</beam>)r   r   r   r<   r  r   r   r   r    r\   r[  r*   rh  r   ri  r   findr  )rB   r   r   rj  raws        rH   testMakeNotationByMeasuresAz Test.testMakeNotationByMeasuresA
  s8   I	tyyS91=	tyyE:A>	t$ 	177C7a#agg0017C2	3
 	AGGBQKPKq!'',,::KP:	< ,,.iil!!'*NPRSTUX	Z388$CDaM D
 Qs   &E<'Fc                   t               }|j                  t        j                  dd      d       |j                  t        j                  dd      d       t	        j
                         }|j                  |      j                  d      }| j                  |j                  d	      d
|       | j                  |j                  d      d
kD  |       y )Nrp   r   rF  rn   rg   rh  r   rg  r  r   z?<tuplet bracket="yes" number="1" placement="above" type="start")r   r   r   r<   r*   rh  r   ri  r  r  r   )rB   r   rj  r  s       rH   testMakeNotationByMeasuresBz Test.testMakeNotationByMeasuresB   s    I	tyyS91=	tyyE:A>,,.iil!!'*388$CDaMMOQRSTW	YrJ   c                   t               }|j                  t        j                  d             |j                  t        j                  d             |j                  t        j                  d             |j                  t        j                  d             | j	                  |j                                |j                  d       | j                  |j                                y )Nrp   rg   Tr  )r   rW   r   r<   r   haveAccidentalsBeenMaderZ  r   r  s     rH   testHaveAccidentalsBeenMadeAz!Test.testHaveAccidentalsBeenMadeA*  s    I	4!	3 	4!	3 2245	$'1134rJ   c                   t               }|j                  t        j                  d      d       t               }|j                  t        j                  d      d       t	               }|j                  ||g       t        j                         }|j                  |      j                  d      }| j                  |j                  d      d       | j                  |j                                y )Nrp   rn   rg   rg  z <accidental>natural</accidental>r   )r   r   r   r<   r
   rW   r*   rh  r   ri  r  r  r   r  rB   r  r	  rs   rj  r  s         rH   testHaveAccidentalsBeenMadeBz!Test.testHaveAccidentalsBeenMadeB5  s    Y
		$+Y
		#*F	"b ,,.iil!!'*388$FGK2245rJ   c                   t               }|j                  t        j                  d             |j                  dt	        j
                  d             |j                  dt	        j
                  d             | j                  |j                                |j                         }| j                  t        |j                         j                  t                    d       | j                  |j                                y )NGbr   zD-5zD-4r6   )r	   r@   r   r  r   r<   r   r  r  r   r   r   r[  r   r   )rB   r   ru  s      rH   #testHaveAccidentalsBeenMadeInVoicesz(Test.testHaveAccidentalsBeenMadeInVoicesD  s    G		DIIe$%	DIIe$%2245~~T\\^>>uEFJ4467rJ   c                   t               }t        j                  d      |_        |j	                  t        j                  dd      d       t               }|j	                  t        j                  dd      d       t               }|j                  ||g       | j                  |j                  j                         |j                  d       | j                  |j                  j                         y )	Nr   rp   r   rF  r   rg   Tr  )r   r   r;   r   r   r   r<   r
   rW   r   r1  r2  r   r   )rB   r  r	  rs   s       rH   testHaveBeamsBeenMadeAzTest.testHaveBeamsBeenMadeAN  s    Y ..u5
		$c:A>Y
		#S91=F	"b--.	D!,,-rJ   c                t   t               }t        j                  d      |_        |j	                  t        j                  dd      d       t               }|j	                  t        j                  dd      d       t               }|j                  ||g       | j                  |j                  j                         t        j                         }|j                  |      j                  d      }| j                  |j                  j                         | j!                  |j#                  d      d	       y )
Nr   rp   r   rF  r   rg   rg  z<beam number="1">end</beam>r   )r   r   r;   r   r   r   r<   r
   rW   r   r1  r2  r*   rh  r   ri  r  r  r  s         rH   testHaveBeamsBeenMadeBzTest.testHaveBeamsBeenMadeBZ  s    Y ..u5
		$c:A>Y
		#S91=F	"b--.,,.iil!!'* 	--.388$ABAFrJ   c                R   t        j                  d      }|j                         }|j                         }| j                  t	        |      t	        |             |j                  dt        j                  d             | j                  t	        |      |j                                y )Nrv  r   ro   )	r   r   r   r   r   r@   r   r<   rV  )rB   r   flat1flat2s       rH   testFlatCachingAzTest.testFlatCachingAj  sn    LL#				EBuI.Q		#'BuIqyy{3rJ   c                   t        j                  d      }|j                  d      }t        j                  d      }|j                         }|j                  }|j                         j                  j                         j                  |      }g }|j                         j                  D ]  }|j                  |j                          | j                  |g d       y )Nzbach/bwv13.6.xmlAltori  )6r:  1 2/32 1/3r:  r  r  r:  r  r  2 2/3r:  1 1/3r  r;  r  r:  r  r:  r  r  r:  r  r  r:  r:  r  r  r:  r  r  r  r  r:  r  r  r;  r  r  r:  r  r  r  r:  r  r  r:  r  r  r  r  r:  r  r;  r  )r   r   getElementByIdr   r;   r   r  r  r  rW   r)  r   )	rB   rz  sPartrD   	sPartFlatunused_notesAndRestsr  rr  r   s	            rH   testFlatCachingBzTest.testFlatCachingBs  s    ||./##F+  ' MMO	(66MMO1188:GGK	""$22AMM!))$ 3 "P 	QrJ   c                   t        j                  d      j                  j                         }t	        |j                               }|t        j                     j                         }|j                         j                  |t        j                  d             t	        |j                               }|j                  t              d   }|d   j                  dt        j                  d             |t        j                     }|j                         j                  D ]!  }|j                  t        j                        }# |j                  t        j                   d      d      }	y )	Nr/  r1  r5   r   r3   r^  Fr  )r   r   r   r  r   r   r   r=  r_  r[  r   r@   r   r  invertDiatonicr   r<   )
rB   r5  unused_idFlat1r8  unused_idFlat2	unused_m1unused_keySigSearchr   r   
unused_qj2s
             rH   testFlatCachingCzTest.testFlatCachingC  s   \\1288>>@BJJL)   !'')


R!1!1"!56BJJL) ))'215	 	1Q((+, !1!12##A&&s'7'78D $ &&tyy&F
rJ   c                4   t               }|j                  dt        j                  d             |j	                         }| j                  |j                         j                  d   j                  d       |j                  dt        j                  d             |j	                         }| j                  |j                         j                  d   j                  d       |j	                  t        j                  d            }| j                  |j                         j                  d   j                  d       |j	                  t        j                  d            }| j                  |j                         j                  d   j                  d       y)	zm
        doctests sufficiently search invertDiatonic for complex cases,
        but not simple ones.
        r   rG  rI  rr  zF#3G3rB  N)r   r@   r   r<   r  r   r   r   r4  r   r  )rB   r   r	  rS  rG  m5s         rH   testInvertDiatonicQuickSearchz"Test.testInvertDiatonicQuickSearch  s   
 I	DIIdO$++A.==tD	CGGCL!++A.==uEdiio.++A.==tDdiio.++A.==tDrJ   c                   t        j                  d      }|j                  d      }|j                  d      }| j                  t	        |      t	        |             |j
                  d   j                  t              d   j                  t        j                        }| j                  t        |      d       |j
                  d   j                  t              d   j                  d   j                  }| j                  |d       y )Nrv  Tr  r   r7   r  3)r   r   r   r   r   r   r[  r   r  r   r;   r   r   r)  )rB   r   ssf1ssf2rD   r)  s         rH   testSemiFlatCachingAzTest.testSemiFlatCachingA  s    LL#yy$y/yy$y/D2d8,WWQZ**73A6HHI\I\]R"EF ''!*//8;AA!DLL#&rJ   c                   t               }t               }t               }|j                  d|       |j                  d|       | j                  t	        |j
                        d       |j                  d       | j                  t	        |j
                        d       t               }t               }t               }t        j                         }t        j                         }|j                  d|       |j                  d|       |j                  d|       |j                  d|       | j                  t	        |j
                        d       |j                  d       | j                  t	        |j
                        d       | j                  t	        |j                        d       | j                  |j                  |      d       | j                  |j                  |      d	       t               }t               }t               }t        j                         }t        j                         }t        j                         }|j                  d|       |j                  d|       |j                  d|       |j                  d|       |j                  d|       | j                  t	        |j
                        d       |j                  d       | j                  t	        |j
                        d       |j                  dd
       | j                  t	        |j
                        d       | j                  t	        |j                        d       y )Nr   r6   Tr  ry   r{   r  rQ  F   )forcer  r7   )r   r   r@   r   r   r  flattenUnnecessaryVoicesr   r<   r   r  )rB   r   r  r  r   r   r   s          rH   testFlattenUnnecessaryVoicesAz"Test.testFlattenUnnecessaryVoicesA  sh   HWW	B	BQXX*	""4"0QXX* HWWYY[YY[
		"b
		"b	R	RQXX*	""4"0QXX*QWWq)++A.3++A.3 HWWYY[YY[YY[
		"b
		"b
		"b	R	RQXX*	""4"0QXX*	""t"<QXX*QWWq)rJ   c                   t               }t        j                         }t        j                         }t        j                         }|j                  d|       |j                  d|       |j                  d|       | j	                  |j                  d      |       | j	                  |j                  d      |       | j	                  |j                  d      |       | j	                  |j                  d      |       | j	                  |j                  d      d        | j	                  |j                  d      |       | j	                  |j                  ddg      |       | j	                  |j                  ddg      |       y )	Nr   r7   r3   ffffff@皙	@333333?r<   r   )r   r   r<   r@   r   getElementBeforeOffsetrB   r   r   r   r   s        rH   testGetElementBeforeOffsetAz Test.testGetElementBeforeOffsetA  s1   HYY[YY[YY[	B	B	B11!4b911#6;11!4b911#6;11!4d;11#6;11!fX>C11#GLrJ   c                   t               }t        j                         }t        j                         }t        j                         }|j                  d|       |j                  dt	        j
                                |j                  dt	        j                                |j                  d|       |j                  dt	        j                                |j                  dt	        j                                |j                  d|       | j                  |j                  ddg      |       | j                  |j                  ddg      |       | j                  |j                  ddg      |       | j                  |j                  ddg      |       | j                  |j                  ddg      d        | j                  |j                  d	dg      |       y )
Nr   r6   r7   g@r3   r<   r  r  r  )r   r   r<   r@   r   SopranoClefr  r<  r  r   r  r  s        rH   testGetElementBeforeOffsetBz Test.testGetElementBeforeOffsetB  s`   HYY[YY[YY[	B	D$$&'	DMMO$	B	DOO%&	dnn&'	B11!fX>C11#x@"E11!fX>C11#x@"E11!fX>E11#x@"ErJ   c                   t               }t               }|j                  t        j                  d      d       t               }|j                  t        j                  d      d       |j                  ||g       d|_        | j                  t        |j                  t              d   j                        d       | j                  t        |j                        d       d|_        | j                  t        |j                  t              d   j                        d       | j                  t        |j                        d       y )	Nr   rF  r6   dottedrP   z!<music21.bar.Barline type=dotted>rr  r  )r   r   r   r   r<   rW   r  r   r   r[  r  )rB   r   r  r	  s       rH   testFinalBarlinePropertyAzTest.testFinalBarlinePropertyA"  s    HY
		4a8Y
		4a8	"b!Q11':2>KKL<	>Q^^,<	> !Q11':2>KKL;	= 	Q^^,;	=rJ   c                   t        j                  d      }|j                  d   }| j                  t	        |j
                        d       d|_        | j                  t	        |j
                        d       d|_        | j                  t	        |j
                        d       dd	g|_        | j                  t	        |j
                        d
       y )Nrv  r   r  r  r  tickz[<music21.bar.Barline type=tick>, <music21.bar.Barline type=tick>, <music21.bar.Barline type=tick>, <music21.bar.Barline type=tick>]rr  r  z[<music21.bar.Barline type=final>, <music21.bar.Barline type=none>, <music21.bar.Barline type=final>, <music21.bar.Barline type=none>])r   r   r   r   r   r  )rB   r   sops      rH   testFinalBarlinePropertyBzTest.testFinalBarlinePropertyB8  s    LL#ggajS--.0RS#S--.0ST  Q^^,_	`
 "6*Q^^,`	arJ   c                    t        j                  d      }t               }|j                  |       t               }||_        | j                  ||       y )Nr  )r   r  r   rS  r[   r   )rB   rE   r   rg   s       rH   -testSetElementsFromOtherStreamWithEndElementsz2Test.testSetElementsFromOtherStreamWithEndElementsK  s>    KK!H	QH
arJ   c                   t               }|j                  t        j                         d       t        j                         }|j	                  |       t               }||_        g }|j
                  D ]"  }|j	                  |j                  |             $ | j                  |g d       | j                  t        |d         t        |d                t               }t               }|j                  d|       |j
                  |_        g }|j
                  D ]"  }|j	                  |j                  |             $ | j                  |g d       t        |d d        }g }|j
                  D ]"  }|j	                  |j                  |             $ | j                  |g d       ||_        g }|j
                  D ]"  }|j	                  |j                  |             $ | j                  |g d       t               }||_        g }|j
                  D ]"  }|j	                  |j                  |             $ | j                  |g d       y )Nr  )r   r   r   r   r   r   r  r  rP   r  )r   r   r   r   r   r   r  r  )
r   r   r   r<   rW   r[   r  r   r   r@   )	rB   ri   r   rj   r  r   r  r  r  s	            rH   testStreamElementsComparisonz!Test.testStreamElementsComparisonU  s   X
		Q'YY[
		"XALL**2./  HIBrFR2Z0XX
		"bkkALL**2./  	 IJ BqE]ALL**2./  IJ ALL**2./  HIXALL**2./  HIrJ   c                   t               }|j                  dt        j                  d             |j	                  t        j                         d       | j                  |j                  d       t               }|j                  dt        j                  d             |j	                  t        j                         d       | j                  |j                  d       t               }|j                  dt        j                  d             |j	                  t        j                         d       | j                  |j                  d       t               }|j                  dt        j                  d             |j	                  t        j                         d       |j                  d	t        j                  d             | j                  |j                  d
       t               }|j                  dt        j                  d             |j	                  t        j                         d       |j                  dt        j                  d             |j                  d	t        j                  d             |j                  dt        j                  d             | j                  |j                  d       y )Nr   rQ  r  g      N@Z   r  rw   rP  r   r  r,     rE  i  g      <@)	r   r@   r#   MetronomeMarkr   r   r<   r   secondsr!  s     rH   testSecondsPropertyAzTest.testSecondsPropertyA  s   H	E''r23	tyy{B'D)H	E''r23	tyy{B'D)H	E''s34	tyy{B'D) H	E''r23	tyy{B'	U((45K0H	E''r23	tyy{B'	U((45	U((45	U((45 	$=>rJ   c                   t        j                  d      }|j                         }| j                  t	        |j                  t        j                              d       |j                  dt        j                  d             | j                  |j                  d       |j                  t        j                         |j                  dt        j                  d             | j                  |j                  d       |j                  t        j                         |j                  dt        j                  d             | j                  |j                  d	       y )
Nrv  rn   r   adagiog5F$IC@prestog&Moz'@prestissimogFN$@)r   r   r   r   r   r[  r#   TempoIndicationr@   r  r  r  r   )rB   r   sFlats      rH   testSecondsPropertyBzTest.testSecondsPropertyB  s    LL#		U55e6K6KLMqQQ++H56u}}k:E112Q++H56u}}k:E112Q++M:;u}}k:rJ   c                8   t               }t               }t        j                  d      |_        t        j                  d      }|j                  d|       |j                  t        j                  d             |j                  |       t               }t        j                  d      |_        |j                  t        j                  d             |j                  |       t               }t        j                  d	      |_        |j                  t        j                  d
             |j                  |       | j                  |j                  t              D cg c]  }|j                   c}g d       d|_        | j                  |j                  t              D cg c]  }|j                   c}g d       d|_        | j                  |j                  t              D cg c]  }|j                   c}g d       y c c}w c c}w c c}w )Nr/   rQ  r  r   r7   rF  rx   r3   rf   r6   )r   r   r   rw   )r   rY  r   r   )r  r	  r   )r   r   r   r;   r   r#   r  r@   r   r<   rW   r   r[  r  r  )rB   r   r  r  r	  rS  r   s          rH   testSecondsPropertyCzTest.testSecondsPropertyC  s   HY ..u5  +
		!R
		$))!,-	Y ..u5
		$))!,-	Y ..u5
		$))!,-	Q-A-A'-JK-J!))-JK_]	Q-A-A'-JK-J!))-JK_]	Q-A-A'-JK-J!))-JKM]^ L L Ls   #H)H/Hc                h   t               }|j                  t        j                         d       |j	                  dt        j                  d      g       |j                         }| j                  |j                  |dd      d       | j                  |j                  |dd      d       | j                  |j                  |dd      d	       t               }|j                  t        j                         d       |j	                  dt        j                  d      d
t        j                  d      g       |j                         }| j                  |j                  |dd
      d       | j                  |j                  |d
d      d       | j                  |j                  |dd      d       y )Nr   r   rQ  r  r5   r   r6   r   r  rn   rw   r   r  
r   r   r   r<   r@   r#   r  metronomeMarkBoundariesr   _accumulatedSecondsrB   r   mmBoundariess      rH   testAccumulatedTimeAzTest.testAccumulatedTimeA  s\   H	tyy{A&	!U((345002..|QBCH..|QBCH..|QBCH H	tyy{A&	!U((3U((46 	7002..|QBCH..|QBCH..|QBCHrJ   c           
     >   t               }|j                  t        j                         d       |j	                  dt        j                  d      dt        j                  d      dt        j                  d      g       |j                         }| j                  |j                  |dd      d	       | j                  |j                  |dd      d
       | j                  |j                  |dd      d       | j                  |j                  |dd      d       y )Nr   r   rQ  r  rn   rw   r   r  r   r   r   r  r  r  s      rH   testAccumulatedTimeBzTest.testAccumulatedTimeB  s    H	tyy{A&	!U((3U((4U((46 	7 002..|QBCH..|QBCH..|QBCH..|QBCHrJ   c           
     &   t               }|j                  t        j                         d       |j	                  dt        j                  d      dt        j                  d      dt        j                  d      g       | j                  t        |j                               d	       t               }|j                  t        j                         d       |j	                  dt        j                  d      dt        j                  d      g       | j                  t        |j                               d
       t               }|j                  t        j                         d       | j                  t        |j                               d       t               }|j                  t        j                         d       |j	                  dt        j                  d      g       | j                  t        |j                               d       t               }|j                  t        j                         d       |j	                  dt        j                  d      g       | j                  t        |j                               d       y )Nr   r   r  r  rn   rw   r   r  z[(0.0, 4.0, <music21.tempo.MetronomeMark maestoso Quarter=90>), (4.0, 6.0, <music21.tempo.MetronomeMark animato Quarter=120>), (6.0, 8.0, <music21.tempo.MetronomeMark Quarter=240>)]z[(0.0, 4.0, <music21.tempo.MetronomeMark animato Quarter=120>), (4.0, 6.0, <music21.tempo.MetronomeMark animato Quarter=120>), (6.0, 8.0, <music21.tempo.MetronomeMark Quarter=240>)]z?[(0.0, 8.0, <music21.tempo.MetronomeMark animato Quarter=120>)]zv[(0.0, 6.0, <music21.tempo.MetronomeMark animato Quarter=120>), (6.0, 8.0, <music21.tempo.MetronomeMark Quarter=240>)]z7[(0.0, 8.0, <music21.tempo.MetronomeMark Quarter=240>)])
r   r   r   r<   r@   r#   r  r   r   r  r!  s     rH   testSecondsMapAzTest.testSecondsMapA  s   H	tyy{A&	!U((3U((4U((46 	7 	Q6689T	U H	tyy{A&	!U((4U((46 	7Q6689T	U H	tyy{A&Q6689Z	\ H	tyy{A&	!U((456Q6689T	U
 H	tyy{A&	!U((456Q6689R	TrJ   c                   t               }|j                  t        j                         d       |j	                  dt        j                  d      g       |j                         }d}|D ]a  }|dt        |d         z   dz   t        |d	         z   d
z   t        |d         z   dz   t        |d         z   dz   t        |d         z   dz   z  }c |dd }|dz  }| j                  |d       t               }|j                  t        j                         d       |j	                  dt        j                  d      g       |j                         }d}|D ]a  }|dt        |d         z   dz   t        |d	         z   d
z   t        |d         z   dz   t        |d         z   dz   t        |d         z   dz   z  }c |dd }|dz  }| j                  t        |      d       t               }|j                  t        j                         d       |j	                  dt        j                  d      dt        j                  d      g       |j                         }d}|D ]a  }|dt        |d         z   dz   t        |d	         z   d
z   t        |d         z   dz   t        |d         z   dz   t        |d         z   dz   z  }c |dd }|dz  }| j                  |d       t               }|j                  t        j                  d             |j	                  dt        j                  d      dt        j                  d      g       |j                         }d}|D ]a  }|dt        |d         z   dz   t        |d	         z   d
z   t        |d         z   dz   t        |d         z   dz   t        |d         z   dz   z  }c |dd }|dz  }d | _        | j                  |d       y )Nr6   r   rQ  r  [z{'durationSeconds': durationSecondsz, 'voiceIndex': 
voiceIndexz, 'element': elementz, 'offsetSeconds': offsetSecondsz, 'endTimeSeconds': endTimeSecondsz}, rL  ]a  [{'durationSeconds': 0.0, 'voiceIndex': None, 'element': <music21.tempo.MetronomeMark larghetto Quarter=60>, 'offsetSeconds': 0.0, 'endTimeSeconds': 0.0}, {'durationSeconds': 1.0, 'voiceIndex': None, 'element': <music21.note.Note C>, 'offsetSeconds': 0.0, 'endTimeSeconds': 1.0}, {'durationSeconds': 1.0, 'voiceIndex': None, 'element': <music21.note.Note C>, 'offsetSeconds': 1.0, 'endTimeSeconds': 2.0}]r,  a  [{'durationSeconds': 0.0, 'voiceIndex': None, 'element': <music21.tempo.MetronomeMark larghissimo Quarter=15>, 'offsetSeconds': 0.0, 'endTimeSeconds': 0.0}, {'durationSeconds': 4.0, 'voiceIndex': None, 'element': <music21.note.Note C>, 'offsetSeconds': 0.0, 'endTimeSeconds': 4.0}, {'durationSeconds': 4.0, 'voiceIndex': None, 'element': <music21.note.Note C>, 'offsetSeconds': 4.0, 'endTimeSeconds': 8.0}]r5   a0  [{'durationSeconds': 0.0, 'voiceIndex': None, 'element': <music21.tempo.MetronomeMark larghissimo Quarter=15>, 'offsetSeconds': 0.0, 'endTimeSeconds': 0.0}, {'durationSeconds': 4.0, 'voiceIndex': None, 'element': <music21.note.Note C>, 'offsetSeconds': 0.0, 'endTimeSeconds': 4.0}, {'durationSeconds': 0.0, 'voiceIndex': None, 'element': <music21.tempo.MetronomeMark larghetto Quarter=60>, 'offsetSeconds': 4.0, 'endTimeSeconds': 4.0}, {'durationSeconds': 1.0, 'voiceIndex': None, 'element': <music21.note.Note C>, 'offsetSeconds': 4.0, 'endTimeSeconds': 5.0}]r   rF  a  [{'durationSeconds': 0.0, 'voiceIndex': None, 'element': <music21.tempo.MetronomeMark larghissimo Quarter=15>, 'offsetSeconds': 0.0, 'endTimeSeconds': 0.0}, {'durationSeconds': 5.0, 'voiceIndex': None, 'element': <music21.note.Note C>, 'offsetSeconds': 0.0, 'endTimeSeconds': 5.0}, {'durationSeconds': 0.0, 'voiceIndex': None, 'element': <music21.tempo.MetronomeMark larghetto Quarter=60>, 'offsetSeconds': 4.0, 'endTimeSeconds': 4.0}])r   r   r   r<   r@   r#   r  _getSecondsMapr   r   rW   r  )rB   r   sMapsMapStrobs        rH   testSecondsMapBzTest.testSecondsMapB&  s   H	tyy{A&	!U((345!B.R8I5J1KK,-/22l3C/DE)*,/9,>? 00 36b6I2JK 1	1 47r:J7K3L	M
    !G  !B-3K		L H	tyy{A&	!U((345!B.R8I5J1KK,-/22l3C/DE)*,/9,>? 00 36b6I2JK 1	1 47r:J7K3L	M
    !G  !B-3WK		L H	tyy{A&	!U((3U((35 	6 !B.R8I5J1KK,-/22l3C/DE)*,/9,>? 00 36b6I2JK 1	1 47r:J7K3L	M
    !G  !B-3K	L H	-.	!U((3U((35 	6 !B.R8I5J1KK,-/22l3C/DE)*,/9,>? 00 36b6I2JK 1	1 47r:J7K3L	M
    !G  !B-3K		LrJ   c                   t               }|j                  t        j                  d             t               }|j                  t        j                  d             t	               }|j                  |       | j                  t        |j                        d       | j                  |j                  j                  d       |j                  |       | j                  |j                  j                  d       y )Nr~  rF  z <music21.duration.Duration 72.0>      R@g      b@)	r
   rW   r   r<   r	   r   r   r   r   )rB   r   r   r  s       rH   testPartDurationAzTest.testPartDurationA  s    V
		$))"-.V
		$))"-.wBT]]+-OP44d;B44e<rJ   c                    t        j                  d      }t               }|j                  |j                  d          | j                  t        |j                  d   j                        d       | j                  t        |j                        d       | j                  |j                  j                  d       |j                  |j                  d          | j                  |j                  j                  d       y )NrB  r   z <music21.duration.Duration 36.0>r  r5   r   )	r   r   r	   rW   r   r   r   r   r   )rB   r   r  s      rH   testPartDurationBzTest.testPartDurationB  s    LL(wAGGAJQWWQZ0013UVT]]+-OP44d;AGGAJ44d;rJ   c                P   t               }d|_        |j                  t        j                  dd      d       t               }|j                  t        j                  dd      d       d	|_        t               }|j                  d
|       |j                  d
|       |j                  dd      }| j                  t        |j                         j                        d       g }g }|j                         j                  t        j                        D ]f  }|j                  D ]U  }d|j                   v r|j#                  |j$                         d	|j                   v s;|j#                  |j$                         W h | j                  |g d       | j                  |g d       y )NrC   r  r6   rF  r   r  r7   rn   rE   r   TFaddPartIdAsGrouprA  r   )rr  rr  rr  rr  rr  rr  rr  rr  )r   r   r   r   r   r   r   r   )r
   r   r   r   r<   r	   r@   r3  r   r   r   r   r[  r   r  rN  groupsrW   r   )	rB   r   r   r   ru  idAidBrg   rs   s	            rH   testChordifyTagPartAzTest.testChordifyTagPartA  s6   V
		$a8!<V
		$a8!<G	B	Bzz4zNT\\^112A6225;;?AYY!((?JJqvv&!((?JJqvv&	  @ 	FGFGrJ   c                   t        j                  d      }g }g }g }g }|j                  dd      }|j                         j	                  t
        j                        D ]  }|j                  D ]  }d|j                  v r|j                  |j                         d|j                  v r|j                  |j                         d|j                  v r|j                  |j                         d|j                  v s|j                  |j                           | j                  |g d	       | j                  |g d
       | j                  t        |      t        |             y )Nrv  TFr  Sopranor  TenorBass)3r   r  rs  r  r   r   r   r   r  r  rs  r   rs  r  r  r  r  rs  r  r  r  r  r  r  r   rs  rs  r  r  r   r   rs  r  r   rs  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  )3r   r   r  r   r   r   r   rs  r  r  r   r  r  r  r  r  r   r  r  r  r   r   r  r  r   r   r  r   r   r   rs  r  r  r  r  r  r  r  r  r   r   r   r   r   r   r   r  r   r   r   r   )r   r   r3  r   r[  r   r  rN  r  rW   r   r   r   )	rB   r   	idSopranoidAltoidTenoridBassru  rg   rs   s	            rH   testChordifyTagPartBzTest.testChordifyTagPartB  s    LL#	zz4zN225;;?AYY($$QVV,QXX%MM!&&)ahh&NN166*QXX%MM!&&)  @ 	 %O 	P 	 "2 	3 	YV5rJ   c                
   t        j                         }t        j                         }t               }|j	                  t        j                  d      d       |j                  d|       |j                  d|       |j                  d       t               }|j	                  t        j                  d      d       |j                  d|       |j                  d       t               }|j                  d|       |j                  d|       |j                  dd      }| j                  |j                  D cg c]  }t        |       c}g d	       d|_        |j                  d      }| j                  |j                  D cg c]  }t        |       c}g d
       d|_        |j!                  d      }| j                  |j                  D cg c]  }t        |       c}g d       d|_        |j                  d      }| j                  |j                  D cg c]  }t        |       c}g d       d|_        |j!                  d      }| j                  |j                  D cg c]  }t        |       c}g d	       | j#                  |j                         d|j$                  d   _        d|j$                  d   _        |j                  d      }| j                  |j$                  d   j                  D cg c]  }t        |       c}g d
       | j                  |j$                  d   j                  D cg c]  }t        |       c}g d       | j                  |j$                  d   j                  d       | j                  |j$                  d   j                  d       |j                  d       | j                  |j$                  d   j                  D cg c]  }t        |       c}g d
       | j                  |j$                  d   j                  D cg c]  }t        |       c}g d       d|_        d|j$                  d   _        d|j$                  d   _        |j$                  d   t&           D ]	  }d|_         |j!                  d       | j                  |j$                  d   j                  D cg c]  }t        |       c}g d       | j                  |j$                  d   j                  D cg c]  }t        |       c}g d       y c c}w c c}w c c}w c c}w c c}w c c}w c c}w c c}w c c}w c c}w c c}w )Nrd   rn   r   r6   Tr  F)r  reverse)rG  rG  re   re   )rI  rI  B-3r  )rd   rd   rd   rd   r5   )r  r  r  r  unknown)r   EnglishHornClarinetr
   r   r   r<   r@   r  r	   _transposeByInstrumentr   rN  r   atSoundingPitchtoSoundingPitchtoWrittenPitchr   r   r   )	rB   i1i2r   r   r   r  rs   r[  s	            rH   testTransposeByPitchAzTest.testTransposeByPitchA  ss   ##%  "V
		$+
		!R
		!R
%V
		$+
		!R
%G	B	B(((E$,,7,Q#a&,79QR #!!%!0$,,7,Q#a&,79ST #   / 	$,,7,Q#a&,79QR "!!%!0$,,7,Q#a&,79QR "   /$,,7,Q#a&,79QR--. &+
"%*
"   /$**Q-*?*?@*?Q#a&*?@B\]$**Q-*?*?@*?Q#a&*?@B^_ 	33U;33U;	$'!''!**<*<=*<Q#a&*<=?YZ!''!**<*<=*<Q#a&*<=?[\ &%)
"%*
"wwqz'*G ',G# + 	
&!''!**<*<=*<Q#a&*<=?WX!''!**<*<=*<Q#a&*<=?[\i 8 8 8 8 8 A@ >= >=sB   ;T8	T=U%U3U
UU2U4U U%U*c                r   ddl m} t        j                  |j                        }| j                  |j                  d   j                         | j                  |j                  d   j                         | j                  t        |j                  d   j                  t        j                        d   j                        d       | j                  t        |j                  d   j                  t        j                        d   j                        d       |j                  D ]D  }|j                  d   }| j                  |j                          d|_        d|j                   _        F | j                  |j                  d   j                  D cg c]  }t        |       c}g d       | j                  |j                  d   j                  D cg c]&  }|j                   d n|j                   j"                  ( c}g d       | j                  |j                  d   j                  D cg c]  }t        |       c}g d	       | j                  |j                  d   j                  D cg c]&  }|j                   d n|j                   j"                  ( c}g d
       | j                  |j                  d       |j%                  dd       | j                  |j                  d   j                  D cg c]  }t        |       c}g d       | j                  |j                  d   j                  D cg c]&  }|j                   d n|j                   j"                  ( c}g d       | j                  |j                  d   j                  D cg c]  }t        |       c}g d       | j                  |j                  d   j                  D cg c]&  }|j                   d n|j                   j"                  ( c}g d       y c c}w c c}w c c}w c c}w c c}w c c}w c c}w c c}w )Nr   r  r5   z<music21.interval.Interval M-2>z<music21.interval.Interval M-6>T)re   rC  ri  rG  r  r  r  r  )TNFNNNFN)r  r  r  r  E5zF#5zG#5r  )TNFNNFFNr  )r  preserveAccidentalDisplay)rd   re   rC  r^  rG  r  r  r  )TNNNNNNN)r  r  r   r   transposingInstruments72ar   r   r  r   r   r[  r   
InstrumenttranspositionrN  r  r\   r[  r  )rB   r  r   rs   
firstPitchs        rH   testTransposeByPitchBzTest.testTransposeByPitchB;  s   2OOMCCD334334QWWQZ:::;P;PQRSTbbc:	<QWWQZ:::;P;PQRSTbbc:	<
 A1Jj334$%J!26J!!/	  	!''!**<*<=*<Q#a&*<=K	M%&WWQZ%7%79%7 #$,,"6$ALL<V<VV%79K	M 	!''!**<*<=*<Q#a&*<=L	N%&WWQZ%7%79%7 #$,,"6$ALL<V<VV%79L	N 	**I6	$$G!''!**<*<=*<Q#a&*<=I	K%&WWQZ%7%79%7 #$,,"6$ALL<V<VV%79I	K 	!''!**<*<=*<Q#a&*<=I	K%&WWQZ%7%79%7 #$,,"6$ALL<V<VV%79I	K+ >9 >9 >9 >9s0   P+P0P2+P <P%>+P*P/+P4c                d   t        j                  d      }|j                  dt        j                                t        |      }d|_        | j                  |j                  d       |j                  d       | j                  |j                         j                  d   j                  d       y )NztinyNotation: c1 d1r   Tr  r  rG  )r   r   r@   r   Hornr	   r  r   r  r   r   r4  )rB   rs   r   s      rH   testTransposeByPitchCzTest.testTransposeByPitchCh  s    OO12	JOO%&!H **I6 	
&**1-<<dCrJ   c           	        t               }|j                  t        j                  d             |j                  t	        j
                  g d             |j                  t        j                  d             |j                  t	        j
                  ddg             |j                          g }|j                         j                  D ]s  }t        |t        j
                        r3|j                  |D cg c]  }t        |j                         c}       P|j                  t        |j                               u | j                  |dg dddd	gg       y c c}w )
Nr  )r   r  rX  rX  r  <music21.tie.Tie start>)r  <music21.tie.Tie stop>r-  <music21.tie.Tie continue>r  r.  )r   rW   r   r<   r   r  
extendTiesr   r  r  r  r&   r   )rB   r   ru  r   rF   s        rH   testExtendTiesAzTest.testExtendTiesAz  s    H	4!	/01	4!	dD\*+	**A!U[[)!4!QT!%%[!45DK(	 +
 	3 7"4	
	 5s   7E
c           	        d | _         t        j                  d      }|j                  dd      j	                         }|j                          g }|j                         j                  t        j                        D ]4  }|j                  |D cg c]  }t        |j                         c}       6 | j                  |g dg dg dg dg dg       y c c}w )Nrv  r)  )r-  r-  r/  )r.  r/  r  r/  )r-  r/  r-  r.  )r.  r.  r.  r  r
  )r  r   r   r  r3  r0  r   r[  r   r  rW   r  r&   r   )rB   r   sChordsru  chr   s         rH   testExtendTiesBzTest.testExtendTiesB  s    LL#**Q"++-//#66u{{CBKKb1baeeb12 D 	995# ;<	 2s   C
c                   t               }|j                  t        j                  d      d       |j	                  dt        j                  d             | j                  |D cg c]  }t        |       c}g d       |j	                  dt        j                  d             | j                  |D cg c]  }t        |       c}g d       |j	                  dt        j                  d             | j                  |D cg c]  }t        |       c}g d	       |j	                  dt        j                  d
dg             | j                  |D cg c]  }t        |       c}g d       y c c}w c c}w c c}w c c}w )Nrw  r   r7   r  )r  r  r  z<music21.chord.Chord D4 G4>r  r  r  r  r  )r  r  r  <music21.chord.Chord D4 G4 B4>r  r  r  r  r3   )r  r  r  r7  r  z<music21.chord.Chord D4 B4>r  r  rx  r  )r  r  r  r7  r  z"<music21.chord.Chord D4 B4 C5 E-5>r  r  )	r   r   r   r<   insertIntoNoteOrChordr   r  r   r  rm  s      rH   testInsertIntoNoteOrChordAzTest.testInsertIntoNoteOrChordA  s?   H	tyy*	499T?31-1a$q'1-3	4 	
499T?31-1a$q'1-3	4 	
499T?31-1a$q'1-3	4 	
5;;e}#=>1-1a$q'1-3	4C . . . .s   $E34E8E=Fc                   t               }|j                  t        j                  g d      d       |j	                  dt        j                  d             |j	                  dt        j                  d             |j	                  dt        j                  g d             | j                  |D cg c]  }t        |       c}g d       y c c}w )	Nr  r   r3   r  r7   r   )r  r  zb-5)<music21.chord.Chord C4 E4 G4>r;  r;  !<music21.chord.Chord C4 E4 G4 B4>r;  r<  z)<music21.chord.Chord C4 E4 G4 D5 E-5 B-5>r;  )	r   r   r   r  r8  r   r<   r   r  rm  s      rH   testInsertIntoNoteOrChordBzTest.testInsertIntoNoteOrChordB  s    H	u{{#56:	499T?3	499T?3	5;;/C#DE1-1a$q'1-<	=-s   2Cc                   dd l }t        j                  d      }|j                  d   }|j	                  t
              D ]|  }|j                  D ]k  }|j                  |      }||j                  |      k7  s)t        j                  |j                        }|j                  |       |j                  ||       m ~ |j                  d       d}t        j                          }	|	j                  |      j#                  d      }
|j%                  dd	      }|j%                  d
d	      }|
j%                  dd	      }|j%                  d
d	      }| j'                  |j)                  |      dkD  d|
       y )Nr   rv  rF  Tr  a"        <note>
        <pitch>
          <step>A</step>
          <octave>4</octave>
        </pitch>
        <duration>5040</duration>
        <type>eighth</type>
        <stem>up</stem>
      </note>
      <note>
        <rest/>
        <duration>5040</duration>
        <type>eighth</type>
      </note>
      <note>
        <pitch>
          <step>G</step>
          <alter>1</alter>
          <octave>4</octave>
        </pitch>
        <duration>10080</duration>
        <type>quarter</type>
        <stem>up</stem>
      </note>
      <note>rg   r   
)mathr   r   r   r[  r   r   r  floorr   r  r   r  r@   r   r*   rh  ri  r_  r   r  )rB   rA  r   rs   r   r   r  r   r  rj  originalRawr  s               rH   testSortingAfterInsertAzTest.testSortingAfterInsertA  s/   LL#GGAJ%%g.AWW 0034::l#;;		@AHHQKHH\1-  / 	
D!2 ,,.iil))'2c2&dB'!!#r*kk$#%1,dK@rJ   c                   t        j                  d      j                  d   }|j                         j	                  t
        j                        d   }|j                         j                  |t        j                  d             |j	                  t              d   j                  dt        j                  d             |j                  t        j                  d      d      }y )	Nr/  r   r1  r5   r3   r^  Fr  )r   r   r   r   r[  r   r=  r_  r   r@   r  r   r<   )rB   r5  r8  r  s       rH   testInvertDiatonicAzTest.testInvertDiatonicA-  s     \\1288;ZZ\,,S-=-=>qA


R!1!1"!56
g&q)00C4D4DQ4GH&&tyy&F
rJ   c                   t        j                  d      }|j                  d   j                  dd      }| j	                  t        |j                         j                  t        j                        d         d       | j	                  t        |j                         j                  t        j                        d         d       |j                  d   j                  t              d   }| j	                  t        |j                  t              d         t        |             |j                  t              D ]w  }|j                  D ]f  }|j                  dk(  s|j!                  |      }|j#                  |       t%        j&                  |j(                        }|j+                  ||       h y | j	                  t-        |t$        j&                           d	       y )
Nrv  r   r7   r   z<music21.clef.TrebleClef>zP1: Soprano: Instrument 1r  rF  r3   )r   r   r   r  r   r   r   r[  r   r  r   r%  r   r   r   r   r  r  r   r  r   r@   r   )rB   r   rk  mTargetr   r   r   r   s           rH   testMeasuresAzTest.testMeasuresA7  s`   LL#WWQZ  A&RZZ\<<TYYGJK4	6RZZ\<<Z=R=RSTUVW4	6 ''!*//8;B11':1=>7L&&w/AWW66S=))!,AHHQK		@AHHQN  0 	R		]+Q/rJ   c                P   t        j                  d      }|j                  dd      }| j                  t	        |j
                  d   j                         j                  t        j                              d       t        j                         }|j                  |j
                  d         j                  d      }d}|j                  dd	      }|j                  d
d	      }|j                  dd	      }|j                  d
d	      }| j                  |j                  |      d       y )Nr  r  r  r   r6   rg  ze        <time>
          <beats>2</beats>
          <beat-type>4</beat-type>
        </time>
        r?  r   r@  )r   r   r  r   r   r   r   r[  r   r;   r*   rh  ri  r_  r  r  )rB   r   r   rj  r  r  s         rH   testMeasuresBzTest.testMeasuresBN  s    LL'JJr2GGAJ 33E4G4GHJKL	N ,,.ii
#**73
 kk#r"kk$#c2&dB'388E?A.rJ   c                   t        j                  d      }|j                  d   j                  dd      }t	        |j                  dg            D ]w  }|j                  dk(  s|j                  }|j                  }|j                  j                  |       t        j                  |j                        }|j                  ||       y | j                  t        |t        j                           d	       y )
Nrv  r   r7   r   r<   rk  r  rF  r3   )r   r   r   r  r   r   r   r   r
  r  r   r  r   r@   r   r   )rB   r   rk  r   r   siter   s          rH   testMeasuresCzTest.testMeasuresCe  s    LL#WWQZ  A&bjjfXj67Avv}HH||##A&IIAOO<Aq! 8 	R		]+Q/rJ   c                ~   t               }t        d      }t        d      }t        d      }t        d      }|j                  |       |j                  |       |j                  |       |j                  |       d }|j                  dd      }| j	                   ||      d       | j                  ||       | j                  ||       |j                  dd      }| j	                   ||      d       | j                  ||       | j                  ||       |j                  dd      }	| j	                   ||	      d       | j                  ||	       | j                  ||	       | j                  ||	       |j                  dd      }
| j	                   ||
      d       | j                  ||
       | j                  ||
       |j                  dd      }| j	                   ||      d       | j                  ||       | j                  ||       | j                  ||       | j                  ||       y )	Nr5   r  rV  rW  r7   c                >    t        | j                  t                    S r?  )r   r[  r   )	p_excerpts    rH   numMz%Test.testMeasuresSuffix.<locals>.numM}  s    y33G<==rJ   r6   rn   )r
   r   rW   r  r   r   )rB   rs   r  r  r  rS  rR  mm1mm2mm3mm4mm5s               rH   testMeasuresSuffixzTest.testMeasuresSuffixr  s   FAT"T"A					> jjD!cA&b#c3jjt$cA&c3c3jjq!cA&c3c3b#jjq!cA&c3b#jjAcA&b#c3c3b#rJ   c                   ddl m} t        j                  |j                        }d | _        | j                  |j                  d   j                  t              d   j                  dd      d       | j                  |j                  d   j                  t              d   j                  d      d       |j                         }|j                  t              d   }| j                  |j                  dd      d	       |j                  D cg c]t  }|j                  D cg c]  }t        |       c}t        t        t!        |j"                        d
            t        t        t!        |j$                        d            fv }}}| j'                  t        |      d       t)        j*                         }|j                  |      j-                  d      }	| j'                  |	j/                  d      d
|	       y c c}w c c}}w )Nr   r  T)addEndTimesuseMixedNumeralsa_  {0 - 0} <music21.layout.SystemLayout>
{0 - 0} <music21.clef.TrebleClef>
{0 - 0} <music21.tempo.MetronomeMark Quarter=120 (playback only)>
{0 - 0} <music21.key.Key of B- major>
{0 - 0} <music21.meter.TimeSignature 4/4>
{0 - 2/3} <music21.note.Note B->
{2/3 - 1 1/3} <music21.note.Note C>
{1 1/3 - 2} <music21.note.Note B->
{2 - 4} <music21.note.Note A>r5   )rZ  z{0.0 - 0.0} <music21.clef.BassClef>
{0.0 - 0.0} <music21.tempo.MetronomeMark Quarter=120 (playback only)>
{0.0 - 0.0} <music21.key.Key of B- major>
{0.0 - 0.0} <music21.meter.TimeSignature 4/4>
{0.0 - 4.0} <music21.note.Note B->a{  {0 - 0} <music21.layout.SystemLayout>
{0 - 0} <music21.clef.TrebleClef>
{0 - 0} <music21.tempo.MetronomeMark Quarter=120 (playback only)>
{0 - 0} <music21.key.Key of B- major>
{0 - 0} <music21.meter.TimeSignature 4/4>
{0 - 2/3} <music21.chord.Chord B-2 B-4>
{2/3 - 1 1/3} <music21.chord.Chord B-2 C5>
{1 1/3 - 2} <music21.chord.Chord B-2 B-4>
{2 - 4} <music21.chord.Chord B-2 A4>r6   r7   z[(['B-2', 'B-4'], '0.0', '0.667'), (['B-2', 'C5'], '0.67', '0.667'), (['B-2', 'B-4'], '1.33', '0.667'), (['B-2', 'A4'], '2.0', '2.0')]rg  z<tuplet )r  r  r   r   
triplets01r  assertMultiLineEqualr   r[  r   	_reprTextr3  r   rN  r   roundfloatr   r   r   r*   rh  ri  count)
rB   r  r   rS  r  r   rs   r  rj  r  s
             rH   testChordifyFzTest.testChordifyF  s   2 OOM445!!GGAJ))'215??DSW @ Y!	" 	!!GGAJ))'215??D?Q&	' &&w/2!!",,4RV,"W#(		) CE((LBJQ $%99-9a3q69-eE!((OQ/0eE!//2A679BJ 	 L 	J/	0 ,,.iim""7+:.37 . Ls   H%H 7AH Hc                <   t               }|j                  t        j                  dd      d       |j	                  dt        j                  dd             |j                         }|j                  t        j                        D ]  }| j                  t        |      d        t               }|j                  t        j                  dd      d	       |j	                  dt        j                  dd             |j                         }|j                  t        j                        D ]  }| j                  t        |      d        t               }|j                  t        j                  dd
      d       |j	                  dt        j                  dd             |j                         }|j                  t        j                        D ]  }| j                  t        |      d        t               }|j                  t        j                  dd      d       |j	                  dt        j                  dd             |j                         }|j                  t        j                        D ]  }| j                  t        |      d        y )NrG  rh  rF  r   r   rd   r6   r  r  gUUUUUU?r  gUUUUUU?0   )r   r   r   r<   r@   r3  r[  r   r  r   r   )rB   r   rS  rg   s       rH   testChordifyGzTest.testChordifyG  s   H	tyyU;Q?	DIId!45**5;;7ASVQ' 8 H	tyyU;R@	DIId!45**5;;7ASVQ' 8 H	tyyV<bA	DIId!45**5;;7ASVQ' 8 H	tyyV<bA	DIId!45**5;;7ASVQ' 8rJ   c                   t               }|j                  t        j                  dd      d       |j	                  dt        j                  dd             |j                  d       | j                  t        |j                        d	       | j                  t        |j                  d         d       | j                  t        |j                  d         d       y )
Nzd-4r5   rF  r   r   rd   Tr  r6   )	r   r   r   r<   r@   r  r   r   r  r!  s     rH   testMakeVoicesAzTest.testMakeVoicesA  s    H	tyya8!<	DIId!45	T"QXX*QXXa[)1-QXXa[)1-rJ   c                8   t        j                  d      }|j                  dd      }|j                         j	                  d      }| j                  t        |j                         j                        t        |j                         j                               | j                  |j                         j                  |j                         j                  j                         j                         | j                  t        |j                        d       y )Nrv  r   r  Fr  rn   )r   r   r  r   r  r   r   r   r@  r  r  )rB   r   r  sFlatVoiceds       rH   testMakeVoicesBzTest.testMakeVoicesB  s    LL#JJq!$	'')44U4C 	Y..0667[=P=P=R=X=X9YZ**,88$,,.44;;=II	K[//0!4rJ   c                <   d } |       }|j                  dd      \  }}| j                  ||       | j                  |j                  d       | j                  t	        |j
                        d       | j                  |j                  d       | j                  t	        |j
                        d       t               }|j                  |       |j                  |        |       }|j                  dd      \  }}| j                  ||       | j                  |j                  |j                         | j                  t	        |      t	        |             | j                  t	        |j
                        d        |       }|j                  d      \  }}	| j                  t	        |j
                        d       | j                  t	        |	      d|	j                          |       }|j                  dt        j                  d	             |j                  d      \  }
}| j                  t	        |
      d
       | j                  t	        |      d       | j                  |d   t        j                         | j                  |d   j                  d	       y )Nc                     t               } | j                  t        j                  dd             | j                  t        j                  dd             | j                  t        j                  dd             | S )NrC   r5   rF  rE   r6   rg   )r   rW   r   r<   )r  s    rH   getSz,Test.testSplitAtQuarterLengthA.<locals>.getS  sS    BIIdii156IIdii156IIdii156IrJ   r6   T)retainOriginFr3   r7   r   2/2rn   r5   )splitAtQuarterLengthr  r   r@  r   r   r   rW   r)  r[   r@   r   r;   rV  ratioString)rB   rm  r   leftrightrI  r  r2r  r3r  r4s               rH   testSplitAtQuarterLengthAzTest.testSplitAtQuarterLengthA  s
   	 F,,QT,BedA))1-TZZ!,**A.U[[)1-TUF'''>BQ)9)9:R#d),RXX*F''*BRXX*R!R[[1F	E''./''*BR!$R!$beU%8%89A**E2rJ   c                   t               }t               }|j                  t        j                  dd      d       t               }|j                  t        j                  d      d       |j                  d|       |j                  d|       |j                  d      \  }}| j                  t        |j                         j                        d       | j                  t        |j                        d       | j                  t        |j                         j                        d       | j                  t        |j                        d       t               }|j                  |       |j                  |       y)	zG
        Test if recursive calls work over voices in a Measure
        r  r6   rF  r7   r   r5   r   N)r   r   r   r   r<   r@   rp  r   r   r   r   r  r   rW   )rB   r  r  r  mLeftmRightrI  s          rH   testSplitAtQuarterLengthBzTest.testSplitAtQuarterLengthB:  s    YW
		$a8!<W
		2A6
		!R
		!R //2vU]]_223Q7U\\*A.V^^-334a8V]]+Q/UVrJ   c           	     >   t        j                  d      }|j                  d      \  }}| j                  t	        |j
                        d       | j                  t	        |j
                        d       t        d      D ]  }| j                  t        |j
                  |   j                  t              d   j                        t        |j
                  |   j                  t              d   j                                t        d      D ]  }| j                  t        |j
                  |   j                  t              d   j                        t        |j
                  |   j                  t              d   j                                t        d      D ]  }| j                  t        |j
                  |   j                  t              d   j                        t        |j
                  |   j                  t              d   j                                y)z(
        Test splitting a Score
        rv  r   rn   r   N)r   r   rp  r   r   r   rV   r   r[  r   r   r   rM  )rB   r   sLeftsRightra   s        rH   testSplitAtQuarterLengthCzTest.testSplitAtQuarterLengthCR  s    LL#..q1vU[[)1-V\\*A.qAEKKN55g>qAOOPFLLO66w?BPPQS  qAEKKN55g>qAFFGFLLO66w?BGGHJ  qAEKKN55g>qANNOFLLO66w?BOOPR rJ   c                   t        t        j                  d      g      }| j                  t        d      5  |j                  ddg       ddd       |j                  g d      }| j                  |t               | j                  t        |      d       | j                  |d	   t                | j                  |d	   j                  d       | j                  t        |d	         d
       | j                  |d	   d	   j                  d       | j                  |d
   j                  d       | j                  t        |d
         d
       | j                  |d
   d	   j                  d       | j                  |d   j                  d       | j                  t        |d         d
       | j                  |d   d	   j                  d       | j                  |d   d	   j                  j                  d       y# 1 sw Y   xY w)z6
        Was not returning splitTuples before
        r  rF  z:cannot split by quarter length list whose sum is not equalr   r   N)r   r   r   r7   r   r5   r6   r   r  )r   r   r<   r  r(   splitByQuarterLengthsrV  r)   r   r   r   r   r2   )rB   r   r   s      rH   testSplitByQuarterLengthszTest.testSplitByQuarterLengthsj  s    IIC(
  ##$4$`b##S#J/b ''8e[1UQ'eAh0q//5U1X*q!22C8q//5U1X*q!22C8q//5U1X*q!22C8q!--22I>'b bs   G::Hc                   t               }|j                  t        j                  d             | j	                  |j
                  d       |j                  t        j                  d             t        j                  dd      }|j                  j                         |_        | j	                  |j                  j                  d       |j                  |       | j	                  |j
                  d       |j                  t        j                  d             | j	                  |j
                  d	       |j                  D cg c]  }t        |j                         }}| j	                  |g d
       |j                  dt        j                  d             |j                  D cg c]  }t        |       }}| j	                  |g d       t        j                  dd      j!                         }d|j                  _        |j                  d|       |j                  D cg c]  }t        |       }}| j	                  |g d       yc c}w c c}w c c}w )z%
        testing grace notes
        r  r   mpd#4r   rF  r   r  r   )r  r7  r  r5   r  )r  rd   r7  r  r   r   F)r  zC#4rd   r7  r  N)r   rW   r   r<   r   r@  r   Dynamicr   getGraceDurationr   r   r   r    r+  rN  getGraceslash)rB   r   gn1r   r  gn2s         rH   testGracesInStreamzTest.testGracesInStream  s    I	4!,	!!$'(iiS1||44633S9	,	4!,
 ()ww/w!QWWw/ 34 	
DIIdO,!"+AQ+ 9:
 iiT2;;="	C  "#+AQ+ @A) 0 , ,s   I+I)Ic                   t               }|j                  t        j                  ddg             t        j                  ddgd      }|j                  j                         |_        |j                  |       t        j                  ddgd      }|j                  j                         |_        |j                  |       |j                  t        j                  d	d
gd             t        j                  ddgd      }|j                  j                         |_        |j                  |       |j                  t        j                  ddgd             y )Nr  rw  r  a#4r   rF  r  r  re  rx  r6   rf  ry  r5   )r   rW   r   r  r   r  )rB   r   gc1gc2gc3s        rH   testGraceChordszTest.testGraceChords  s     I	dD\*+kk5%.<||446	kk4,c:||446		dD\;<kk5%.<||446		dD\;<rJ   c                   t               }|j                  t        j                  d             t	        j
                         }|j                  |      j                  d      }| j                  |j                  d      d|       y )Nrr  rg  z<fifths>1</fifths>r   )
r   rW   r   r  r*   rh  r   ri  r  r  )rB   r   rj  r  s       rH   testScoreShowAzTest.testScoreShowA  sa     H	,,.iil!!'*388$891cBrJ   c                   t               }t        j                         }t        j                         }|j                  |       |j                  |       | j	                  t        |t        j                           d       y ry  )r   r'   VariantrW   r   r   )rB   r   r  r  s       rH   testGetVariantsAzTest.testGetVariantsA  sU    H____		Qw/0!4rJ   c                2   t               }|j                  t        j                  d      d       |j	                  d       t        j                         }t               }|j                  t        j                  d      d       |j                  |       |j                  d|       | j                  t        |j                  D cg c]  }|j                   c}      d       | j                  t        |t
        j                           d       |j                  d	d
       | j                  t        |j                  D cg c]  }|j                   c}      d       | j                  t        |t
        j                           d       |j                  d	d
       | j                  t        |j                  D cg c]  }|j                   c}      d       | j                  t        |t
        j                           d       yc c}w c c}w c c}w )z5
        This tests a single-measure variant
        r   r  Tr  G#4rn   <['D', 'D', 'D', 'D', 'D', 'D', 'D', 'D', 'D', 'D', 'D', 'D']r5   FmatchBySpanr  z@['D', 'D', 'D', 'D', 'G#', 'G#', 'G#', 'G#', 'D', 'D', 'D', 'D']Nr   r   r   r<   r  r'   r  r   rW   r@   r   r   rN  r   r   activateVariantsrB   r   r  m2Altrs   s        rH   testActivateVariantsAzTest.testActivateVariantsA  s    H	tyy+	t$__	499U+Q/
		% 	
Baii8iaffi89W	YQw/0!4	ud;aii8iaffi89[	]Qw/0!4	ud;aii8iaffi89W	YQw/0!4 9 9 9s   H
H>Hc                   t               }|j                  t        j                  d      d       |j	                  d       t        j                         }t               }|j                  t        j                  d      d       |j                  |       |j                  j                  d       t        j                         }t               }|j                  t        j                  d      d       |j                  |       |j                  j                  d	       |j                  d|       |j                  d|       | j                  t        |j                  D cg c]  }|j                   c}      d
       | j                  t        |t
        j                           d       |j!                  ddd       | j                  t        |j                  D cg c]  }|j                   c}      d       | j                  t        |t
        j                           d       |j!                  ddd       | j                  t        |j                  D cg c]  }|j                   c}      d       | j                  t        |t
        j                           d       |j!                  d	dd       | j                  t        |j                  D cg c]  }|j                   c}      d       | j                  t        |t
        j                           d       |t
        j                     D cg c]  }|j                   }}| j                  t        |      d       yc c}w c c}w c c}w c c}w c c}w )zV
        This tests two variants with different groups, each a single measure
        r   r  Tr  r  rn   m2-ar  zm2-br  r6   F)groupr  r  z@['D', 'D', 'D', 'D', 'A#', 'A#', 'A#', 'A#', 'D', 'D', 'D', 'D']r  z@['D', 'D', 'D', 'D', 'B-', 'B-', 'B-', 'B-', 'D', 'D', 'D', 'D']z[['default'], ['default']]N)r   r   r   r<   r  r'   r  r   rW   r  r@   r   r   rN  r   r   r  )rB   r   r  r  r  rs   r   r  s           rH   testActivateVariantsBzTest.testActivateVariantsB   s    H	tyy+	t$__	499U+Q/
		%
		 __	499U+Q/
		%
		  	
B	Baii8iaffi89W	YQw/0!4	UDIaii8iaffi89[	]Qw/0!4 	
UDIaii8iaffi89[	]Qw/0!4 	
6udCaii8iaffi89[	]Qw/0!4 $%W__#56#5a#56U%AB1 9
 9 9 9 7s   "M*M/M4M99M>c                   t               }|j                  t        j                  d      d       |j	                  d       t        j                         }t               }|j                  t        j                  d      d       |j                  |       t               }|j                  t        j                  d      d       |j                  |       |j                  d|       | j                  t        |j                  D cg c]  }|j                   c}      d       | j                  t        |t
        j                           d	       |j                  d
d       | j                  t        |j                  D cg c]  }|j                   c}      d       | j                  t        |t
        j                           d	       |j                  d
d       | j                  t        |j                  D cg c]  }|j                   c}      d       | j                  t        |t
        j                           d	       yc c}w c c}w c c}w )z2
        This tests a two-measure variant
        r   r  Tr  r  rn   zA#4r  r5   Fr  zD['D', 'D', 'D', 'D', 'G#', 'G#', 'G#', 'G#', 'A#', 'A#', 'A#', 'A#']Nr  )rB   r   r  r  m3Altrs   s         rH   testActivateVariantsCzTest.testActivateVariantsC3   s    H	tyy+	t$__	499U+Q/
		%	499U+Q/
		% 	
Baii8iaffi89W	YQw/0!4	ud;aii8iaffi89_	aQw/0!4 	
ud;aii8iaffi89W	YQw/0!4 9 9 9s   I
I>Ic                D   t               }|j                  t        j                  d      d       t	        j
                         }|j                  t        j                  d             |j                  t        j                  d             |j                  t        j                  d             |j                  d|       | j                  t        |j                  D cg c]  }|j                   c}      d       | j                  t        |j                        d       | j                  t        |t        j
                           d       |j                  d	d
       | j                  t        |j                  D cg c]  }|j                   c}      d       | j                  t        |j                        d       | j                  t        |t        j
                           d       |j                  d	d
       | j                  t        |j                  D cg c]  }|j                   c}      d       | j                  t        |j                        d       | j                  t        |t        j
                           d       yc c}w c c}w c c}w )z1
        This tests a note-level variant
        r   r  r  r  ry  r3   r  r5   FTr  z?['D', 'D', 'D', 'D', 'D', 'G#', 'A#', 'C#', 'D', 'D', 'D', 'D']N)r   r   r   r<   r'   r  rW   r@   r   r   rN  r   r   r   r  rB   r   r  rs   s       rH   testActivateVariantsDzTest.testActivateVariantsDW   s    H	tyy+OO	5!"	5!"	5!"	Aaii8iaffi89W	YQWWr*Qw/0!4	ud;aii8iaffi89Z	\QWWr*Qw/0!4	ud;aii8iaffi89W	YQWWr*Qw/0!4# 9 9 9s    JJ"Jc                   t               }|j                  t        j                  d      d       t	        j
                         }|j                  t        j                  dd             |j                  t        j                  dd             |j                  t        j                  dd	             |j                  d
|       | j                  t        |j                  D cg c]  }|j                   c}      d       | j                  t        |j                        d       | j                  t        |t        j
                           d	       |j                  dd       | j                  t        |j                  D cg c]  }|j                   c}      d       | j                  t        |j                        d       | j                  t        |t        j
                           d	       | j                  t        t        |t        j
                     j!                         j"                              d       yc c}w c c}w )zK
        This tests a note-level variant with miss-matched rhythms
        r   r  r  r   rF  r  r   ry  r5   r3   r  FTr  z>['D', 'D', 'D', 'D', 'D', 'G#', 'D', 'C#', 'D', 'D', 'D', 'D']z.[<music21.note.Note D>, <music21.note.Note D>]N)r   r   r   r<   r'   r  rW   r@   r   r   rN  r   r   r   r  r   r  r[   r  s       rH   testActivateVariantsEzTest.testActivateVariantsE{   s    H	tyy+OO	545	545	523	Aaii8iaffi89W	YQWWr*Qw/0!4	ud;
 	aii8iaffi89Y	[QWWr*Qw/0!4T!GOO"4":":"<"E"EFGI	K 9 9s   &II
c                6   t               }|j                  t        j                  d      d       t	        j
                         }|j                  dt        j                  d             |j                  t        j                  dd             |j                  t        j                  dd	             |j                  t        j                  d
d	             |j                  d|       | j                  t        |j                         j                        d       | j                  t        |j                  D cg c]  }|j                    c}      d       | j                  t        |j#                  t        j                              d       |j%                  dd       | j                  t        |j                         j                        d       | j                  t        |j                  D cg c]  }|j                    c}      d       | j                  t        |j#                  t        j                              d       |j%                  dd       | j                  t        |j                         j                        d       | j                  t        |j                  D cg c]  }|j                    c}      d       | j                  t        |j#                  t        j                              d       yc c}w c c}w c c}w )z=
        test replacing 1 note with a 3-note variant
        r   r  r   ffr  r   rF  r  r   ry  r3   r  Tr  r+  zI['D', 'D', 'D', 'D', 'D', 'G#', 'A#', 'C#', 'D', 'D', 'D', 'D', 'D', 'D']r5   N)r   r   r   r<   r'   r  r@   r   r  rW   r   r   r   r   r   rN  r   r[  r  r  s       rH   testActivateVariantsBySpanAz Test.testActivateVariantsBySpanA   s9    H	tyy+OO	H$$T*+	545	556	556	A 	QYY[../4aii8iaffi89W	YQ11(2B2BCDaH	tT:QYY[../4+A+,W	Y 	Q11(2B2BCDaH	tT:QYY[../4aii8iaffi89W	Y
 	Q11(2B2BCDaH% 9 , 9s   >L9L4Lc                h   t               }|j                  t        j                  d      d       |j	                  d       t        j                         }t               }|j                  t        j                  d      d       t        j                  d      |_
        |j                  |       |j                  j                  d       |j                  d	|       | j                  t        |j!                         j"                        d       | j                  t        |j%                  t                    d	       | j                  t'        |j(                  D cg c]  }|j*                   c}      d
       |j-                  dd       | j                  t        |j!                         j"                        d       | j                  t        |j%                  t                    d       | j                  |j(                  D cg c]  }|j*                   c}g d       |j-                  ddd       | j                  t        |j%                  t                    d	       | j                  t'        |j(                  D cg c]  }|j*                   c}      d
       yc c}w c c}w c c}w )zF
        test replacing 2 measures by a longer single measure
        r   r   Tr  r  r   z8/4r  rn   zP['D', 'D', 'D', 'D', 'D', 'D', 'D', 'D', 'D', 'D', 'D', 'D', 'D', 'D', 'D', 'D']r  r7   )r   r   r   r   r  r  r  r  r  r  r  r  r   r   r   r   defaultN)r   r   r   r<   r  r'   r  r   r   r;   r   rW   r  r@   r   r   r   r   r[  r   rN  r   r  r  s        rH   testActivateVariantsBySpanBz Test.testActivateVariantsBySpanB   s    H	tyy+	t$__	499U+Q/#11%8
		%
		  	
BQYY[../4Q11':;Q?+A+,^	`
 	
tT:QYY[../4Q11':;Q?!))4)Q!&&)4.	/ 	
9$EQ11':;Q?+A+,^	` , 5 ,s   J%J*J/c                   t        j                  d      }|j                  d   }|j                  dd      }|D ]?  }t	        |t
              r| j                  t        |      d       /| j                  d       A |j                  ddt        j                  h      }d}d}|j                  d	      D ]q  }| j                  |t
        t        j                  t        j                  f       t	        |t        j                        rd}Ut	        |t        j                        spd}s | j                  |d
       | j                  |d       y )Nrv  r7   FT)fillWithRests	removeAllr   z&remove all was supposed to remove all!)r  r  exemptFromRemover  z/No TimeSignature was found even though exemptedz+No Rest found even though fillWithRest=True)r   r   r   templater  r   r   r   failr   r;   r   rV  r   r  r   )rB   rE   rn  	bassEmptyr   
bassEmpty2foundTimeSignature	foundRests           rH   testTemplateAllzTest.testTemplateAll   s   LL#wwqzMMMF	A!W%  Q+		BC	  ]]-15:5H5H4I # K
 #	##T#:A!!!gtyy%:M:M%NO!U001%)"Atyy) 	 ; 	*,]^	#PQrJ   c                   t               }|j                  t        j                  dd             |j                  t        j                  dd             |j                  t        j                  dd             |j                  t        j                  dd             |j                  d   }|j                  t        |j                        dz     }|j                  d	   }t        j                  ||      }t        j                  ||      }|j                  |       |j                  |       t               }||_	        |D ]2  }| j                  |j                  |      |j                  |             4 y )
Nr   r   r1   r   r   r   r   r6   rP   )r   rW   r   r<   r   r   r   
Diminuendor%  r[   r   r  )	rB   r   r   r   r   sp1sp2rj   r4  s	            rH   testSetElementszTest.testSetElements!  s   H	3V,-	3V,-	3V,-	3V,-WWQZWWS\Q&'WWR[!!"b)  R(		XBR//3//24 rJ   c                   t        j                  d      }t        j                  d      }d|_        t        j                  d      }d|_        t        j                  d      }t        j                  d      }t        j                  d      }t        j                  d      }t        j                  d	      }t               }	|	j	                  ||||g       t               }
|
j	                  ||||g       t        t        |	j                        d
z
        D ]F  }|	j                  |   }|	j                  |dg      }|
j                  |      }|
j                  |      }H y )NrH  B3firstBsecondBre   rC  r^  rG  zA-5r5   r<   )
r   r<   r   r   rW   rV   r   r   rT  rw  )rB   r   r   r   r   r  r	  rS  rG  rn  r  ra   note1note2unused_note3unused_note4s                   rH   testGetElementAfterElementzTest.testGetElementAfterElement!  s   YYt_YYt_YYt_YYt_YYt_YYt_YYt_YYuxRR$%h

BB#$s4::*+AJJqME//x@E2259L2259L	 ,rJ   c                :   t        j                         }t               }| j                  t              5  t        ||g       d d d        | j                  t              5  t        |d |j                         g       d d d        y # 1 sw Y   DxY w# 1 sw Y   y xY wr?  )r   r<   r   r   r   rb  r  s      rH   testCoreGuardBeforeAddElementz"Test.testCoreGuardBeforeAddElement1!  sm    IIKH/Aq6N 0/AtQVVX&' 0/ 0///s   BBBBc                b    | D cg c]  }t        |t              s|j                  ! c}S c c}w )z\
        Helper function to return beam list for all notes and rests in the stream.
        )r  r   r2  )srcListr   s     rH   get_beams_from_streamzTest.get_beams_from_streamP!  s)    
 ")GAJq+,FGGGs   ,,c                   t               }t        j                  d      |_        |j	                  t        j                  d      d       |j                         }| j                  |      }| j                  t        j                         t        j                         t        j                         t        j                         g|       y)zN
        Test that for a measure full of quarters, there are no beams
        r   r5   rF  rn   N)r   r   r;   r   r   r   r<   r   r  r   r   Beams)rB   r   r	  r2  s       rH   test_makeBeams__all_quartersz!Test.test_makeBeams__all_quartersW!  s     I--e4	tyyq115[[]**2.$**,

djjlDJJLQSXYrJ   c                   t               }t        j                  d      |_        |j	                  t        j                  d      d       |j                         }| j                  |      }t        j                         }|j                  d       t        j                         }|j                  d       | j                  ||d          | j                  ||d          | j                  ||d	          | j                  ||d
          | j                  ||d          | j                  ||d          | j                  ||d          | j                  ||d          y)zU
        Test a full measure full of eighth is grouped by beams into couples
        r   r   rF  r   rN   rO   r   r5   r6   r7   rn   r3   r   r  Nr   r   r;   r   r   r   r<   r   r  r   r  rW   r   )rB   r   r	  r2  first_note_beamssecond_note_beamss         rH   test_makeBeams__all_eighthsz Test.test_makeBeams__all_eighthsd!  s/    I--e4	tyys3Q7[[]**2.  ::<( JJL  ( 	)584*E!H5)584*E!H5)584*E!H5)584*E!H5rJ   c                   t               }t        j                  d      |_        t	        d      D ]L  }|j                  t        j                  d             |j                  t        j                  d             N |j                         }| j                  |      }| j                  t        j                         gdz  |       y)zF
        Test a full measure of 8th rest followed by 8th note
        r   rn   r   rF  r   N)r   r   r;   r   rV   rW   r   r  r<   r   r  r   r   r  )rB   r   ra   r	  r2  s        rH   'test_makeBeams__eighth_rests_and_eighthz,Test.test_makeBeams__eighth_rests_and_eighth!  s     I--e4qAHHTYYS12HHTYYS12  [[]**2.$**,)A-u5rJ   c                   t               }t        j                  d      |_        t	        d      D ]q  }|j                  t        j                  d             |j                  t        j                  d             |j                  t        j                  d             s |j                         }| j                  |      }t        j                         }|j                  d       |j                  dd       t        j                         }|j                  d	       t        j                         }|j                  d
       |j                  dd       | j                  ||d          | j                  ||d          | j                  ||d          | j                  ||d          | j                  ||d          | j                  ||d          y)z
        Test that the pattern of "1 e a" repeated more than once has correct beams.

        Note: proper beams repr: https://share.getcloudapp.com/12uE7eBA
        rf   r6   r   rF  r   rN   partialrs  r  rO   rr  r   r5   r7   rn   r3   N)r   r   r;   r   rV   rW   r   r<   r   r  r   r  r   )rB   r   ra   r	  r2  r  r  third_note_beamss           rH   test_makeBeams__repeated_1_e_az#Test.test_makeBeams__repeated_1_e_a!  sw    I--e4qAHHTYYT23HHTYYT23HHTYYT23 
 [[]**2.  ::<(	73 JJL  ,::<'	62 	)584*E!H5)584)584*E!H5)584rJ   c                2   t               }t        j                  d      |_        |j	                  t        j                  d      d       |j                         }| j                  |      }t        j                         }|j                  d       |j                  d       t        j                         }|j                  d       |j                  d       t        j                         }|j                  d       |j                  d       t        j                         }|j                  d       |j                  d       | j                  ||d          | j                  ||d	          | j                  ||d
          | j                  ||d          y)zK
        Test that 4 16th notes have proper beams across them all.
        rL  r   rF  rn   rN   r  rO   r   r5   r6   r7   Nr  )rB   r   r	  r2  r  r  r  fourth_note_beamss           rH   test_makeBeams__1_e_n_azTest.test_makeBeams__1_e_n_a!  sG    I--e4	tyyt4a8[[]**2.  ::<(( JJL  ,  ,::<
+
+ JJL  (  ( 	)584*E!H5)584*E!H5rJ   c                   t               }t        j                  d      |_        |j	                  t        j                  d             |j	                  t        j                  d             |j	                  t        j                  d             |j	                  t        j                  d             |j	                  t        j                  d             |j                         }| j                  |      }t        j                         }|j	                  d       |j	                  dd       | j                  ||d	          y
)zR
        Test that a 16th+8th notes after a 16th notes have proper beams.
        rf   r   rF  r   r  rN   r  rs  r7   N)r   r   r;   r   rW   r   r<   r   r  r   r  r   )rB   r   r	  r2  r  s        rH   $test_makeBeams__1_e__after_16th_notez)Test.test_makeBeams__1_e__after_16th_note!  s     I--e4	./	./	./	./	./[[]**2. !JJL  )  G4 	*E!H5rJ   c                   t               }t        j                  d      |_        d|_        |j                  t        j                  d      d       |j                  d       | j                  |      }t        j                         }|j                  d       t        j                         }|j                  d	       t        j                         }|j                  d
       | j                  |d   t        j                                | j                  |d   |       | j                  |d   |       | j                  |d   |       | j                  |d   |       y )Nro  r   rM   r1   r3   Tr  rN   r  rO   r   r5   r6   r7   rn   )r   r   r;   r   r  r   r   r<   r   r  r   r  rW   r   )rB   r   r2  
start_beamcontinue_beam	stop_beams         rH   test_makeBeams__paddingLeft_2_2z$Test.test_makeBeams__paddingLeft_2_2!  s   I--e4	tyyh/3	D!**1-ZZ\
'"

Z(JJL	 q4::<0q:.q=1q=1q9-rJ   c                &   t               }t        j                  d      |_        d|_        |j                  t        j                  d             |j                  t        j                  d             |j                  t        j                  d             |j                         }| j                  |      }t        j                         }t        j                         }|j                  d       t        j                         }|j                  d       | j                  ||||g       d|_        |j                  t        j                  d             |j                         }| j                  |      }| j                  |||||g       y )	Nri  r   r0   r1   rM   rN   rO   r   )r   r   r;   r   paddingRightrW   r   r<   r   r  r   r  r   )rB   r   r	  r2  no_beamr  r  rS  s           rH   test_makeBeams__paddingRightz!Test.test_makeBeams__paddingRight"  s    I--e4		*+	)*	)*[[]**2.**,ZZ\
'"JJL	 '7 ;<	)*[[]**2.':y IJrJ   c                   t        t        j                         g      }t        j	                  d      }t        j	                  d      }t        j	                         }|j                         }|j                  |      }|j                  |      }|j                  t        |            }|j                  t        |            }	|j                  |      }
| j                  |j                  d       | j                  |j                  d       | j                  |j                  d       | j                  |j                  d       | j                  |	j                  d       | j                  |
j                  d       | j                  t        |      t        |             | j                  t        |      t        |	             |||||
fD ]  }t        j                  |        y )Nmusicxmlsuffixxmlr  z	.musicxmlz.xml)r   r   r<   rr  getTempFilewriter   r   r  osr  )rB   r   tmpMusicxmltmpXmltmpNoSuffixout1out2out3out4out5out6r  s               rH   	testWritezTest.testWrite""  sw   DIIK=!"..j.A)))7"..0 wwyww+w&ww&w!ww#k*w+ww#f+w&ww+w&k2k2f-k2f-k2TCI.TCI.fk4@BIIbM ArJ   c                0   t               }t               }t               }t        j                  d      }t        j                  d      }|j	                  |       |j	                  |       |j	                  ||g       |j                         }t        |      j                  dd      }| j                  |       t        j                  |       t        j                  |       |j                         }t        |      j                  dd      }| j                  t        |      j                  d             | j                  t        j                  j                  |             t        j                  |       t        j                  |       t        j!                  d      }|j                  |      }t        |      j                  dd      }| j                  t        |      j                  d	             | j                  t        j                  j                  |             t        j                  |       t        j                  |       t        j                  |       |j                  d
      }t        |      j                  dd      }| j                  t        |      j                  d             | j                  t        j                  j                  |             t        j                  |       t        j                  |       y )NztinyNotation: 4/4 e1ztinyNotation: 4/4 f1z-2z-1z-2.musicxmlr  r  r  z-2.xmlr  )fmtz-2.mid)r   r	   r   r   rW   r  r   r_  r  r  r  r   endswithpathexistsrr  r  )	rB   r   ri   rj   r   r   out	otherFiletmps	            rH   testOpusWritezTest.testOpusWriteC"  s   FWW__34__34
		"
		"	"bggiH$$T40	S!
		#
		) ggiH$$T40	C))-89y12
		#
		) &&e&4gggoH$$T40	C))(34y12
		#
		#
		) gg&g!H$$T40	C))(34y12
		#
		)rJ   c                   t        j                         }t        |g      }t        |g      }| j                  |j                  |       | j                  |j                         | j                  |j                  |       y r?  )r   r<   r   r  r
  r   r   )rB   r   ri   rj   s       rH    testActiveSiteAfterBoolIterationz%Test.testActiveSiteAfterBoolIterationm"  sW    IIKQC[QC[allB'!allB'rJ   N(  r   r   r   r   r   r   r   r  r  r  r  r&  r4  r:  r=  rB  rJ  rM  rT  rW  rY  r`  re  rl  rp  rx  r~  r  r  r  r  r  r  r  r  r   r  r  r  r!  r,  r5  r9  r@  rJ  rV  r\  ri  rp  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r"  r$  r*  r-  r=  rC  rI  rP  rT  r\  rc  rp  rs  ru  r  r  r  r  r  r  r  r  r  r  r  r  r  r	  r  r  r  r   r5  r:  r=  rB  rI  rO  rd  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r!  r&  r(  r-  r;  r>  rE  rJ  rM  r^  ra  rg  rm  rt  r{  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r5  r8  r>  rA  rI  rM  rR  rX  r]  r`  re  ri  rn  rs  rx  r}  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r
  r  r   r(  r+  r1  r5  r9  r=  rD  rF  rI  rK  rN  rX  rb  re  rg  rj  rw  r{  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  staticmethodr  r  r  r  r  r  r  r  r  r   r	  r  r   rJ   rH   r   r   =  s   #9
V&P=&$ L8
0DdL,3 
$D+C(N8''R,*\39 "1H1$3B D@>,"	,HWT:6(
.5`9<C0-0#*J4(;2>
"; ";Fz<@7Z
xQ.(7\99z1Nf"EH(1T1$109'v&3^)3Vn6d*>,1`84O4
/	='KR(BT2(4* 848>)<.8->)!V(!T&9PB&--^RP2`:?^:Xb>?@FD028092C4un!=F(7T/8!1H;L55n5:1Ef1*.X1*JNlIVB@D3()7V"GJi^X*R\P8<$O6O:O:>,>4AF:0dlF\;D0d+
ZGB&l)\4C<c@KJZF<)GVF(HB6.3.E5<5RnQF.BO8G4$
I32BJ%1N-9`NBPD5AtYn88t>JDS8%* 2H,S^#(X92GHR197 - T4+4Z.j4W$	]6N,Y	568
.G 4Q.G2E"'5*nM&F*=,a&0Jd!?F; _DI&I(TTrLh="<H2#6JF]P+KZD$2<-4`=$8AtG0./.
0(T58t!(F.
5'3T0R0?>,B\=0C55@0Cd"5H5HK@"IL%`PR64&:4(> H HZ6>6#5J 6D62.,K4B(T(rJ   r   __main__verbose);
__future__r   rX   r  r   unittestr#  rt  r   music21.stream.baser   r   r   r   r	   r
   r   r   music21.baser   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r    r!   r"   r#   r$   r&   r'   r(   r)   r  r*   r  r+   r  Environmentrr  TestCaser-   r   r   mainTestr   rJ   rH   <module>r     s    #  	    $ / & % ' % $ $  &                          6 % 3&{&&~6v8$$ vtvD(8 vD(tI zGT9% rJ   