@@ -297,8 +297,8 @@ def _updateFromParameters(
297297 but we want the objects to retain their initial root, bass, and inversion.
298298 '''
299299 if root and isinstance (root , str ):
300- root = common .cleanedFlatNotation (root )
301- self .root (pitch .Pitch (root , octave = 3 ))
300+ root_str = common .cleanedFlatNotation (root )
301+ self .root (pitch .Pitch (root_str , octave = 3 ))
302302 elif root is not None :
303303 self .root (root )
304304
@@ -308,8 +308,8 @@ def _updateFromParameters(
308308
309309 # and then bass.
310310 if bass and isinstance (bass , str ):
311- bass = common .cleanedFlatNotation (bass )
312- self .bass (pitch .Pitch (bass , octave = 3 ), allow_add = True )
311+ bass_str = common .cleanedFlatNotation (bass )
312+ self .bass (pitch .Pitch (bass_str , octave = 3 ), allow_add = True )
313313 elif bass is not None :
314314 self .bass (bass , allow_add = True )
315315
@@ -2267,9 +2267,9 @@ def findFigure(self):
22672267 >>> from xml.etree.ElementTree import fromstring as EL
22682268 >>> MP = musicxml.xmlToM21.MeasureParser()
22692269
2270- >>> elStr = (r '<harmony><root><root-step>C</root-step></root><kind>dominant</kind>' +
2271- ... '<degree><degree-value>9</degree-value><degree-alter>-1</degree-alter>' +
2272- ... ' <degree-type>add</degree-type></degree></harmony>')
2270+ >>> elStr = ('<harmony><root><root-step>C</root-step></root><kind>dominant</kind>'
2271+ ... '<degree><degree-value>9</degree-value><degree-alter>-1</degree-alter>'
2272+ ... ' <degree-type>add</degree-type></degree></harmony>')
22732273 >>> mxHarmony = EL(elStr)
22742274
22752275 >>> cs = MP.xmlToChordSymbol(mxHarmony)
@@ -2283,10 +2283,10 @@ def findFigure(self):
22832283 <music21.pitch.Pitch B-3>,
22842284 <music21.pitch.Pitch D-4>)
22852285
2286- >>> elStr = (r '<harmony><root><root-step>C</root-step></root><kind>major</kind>' +
2287- ... '<bass><bass-step>B</bass-step><bass-alter>-1</bass-alter></bass>' +
2288- ... '<degree><degree-value>2</degree-value><degree-alter>0</degree-alter>' +
2289- ... ' <degree-type>add</degree-type></degree></harmony>')
2286+ >>> elStr = ('<harmony><root><root-step>C</root-step></root><kind>major</kind>'
2287+ ... '<bass><bass-step>B</bass-step><bass-alter>-1</bass-alter></bass>'
2288+ ... '<degree><degree-value>2</degree-value><degree-alter>0</degree-alter>'
2289+ ... ' <degree-type>add</degree-type></degree></harmony>')
22902290 >>> mxHarmony = EL(elStr)
22912291
22922292 >>> cs = MP.xmlToChordSymbol(mxHarmony)
@@ -2682,8 +2682,13 @@ def testHarmonyPreservesInversionAndBass(self):
26822682 self .assertEqual (explicitFm6 .inversion (), 1 )
26832683 self .assertEqual (explicitFm6 .bass (find = False ).name , 'A-' )
26842684 self .assertEqual (explicitFm6 .root (find = False ).name , 'F' )
2685- self .assertLess (explicitFm6 .bass (find = False ).octave ,
2686- explicitFm6 .root (find = False ).octave )
2685+ fm6bassOctave = explicitFm6 .bass (find = False ).octave
2686+ fm6rootOctave = explicitFm6 .root (find = False ).octave
2687+ self .assertIsNotNone (fm6bassOctave )
2688+ self .assertIsNotNone (fm6rootOctave )
2689+ assert fm6bassOctave is not None
2690+ assert fm6rootOctave is not None
2691+ self .assertLess (fm6bassOctave , fm6rootOctave )
26872692
26882693 def testClassSortOrderHarmony (self ):
26892694 '''
@@ -2836,7 +2841,6 @@ def runTestOnChord(self, xmlString, figure, pitches):
28362841 self .assertEqual (cs1 .bass (), cs3 .bass ())
28372842
28382843 def testChordWithBass (self ):
2839-
28402844 xmlString = '''
28412845 <harmony>
28422846 <root>
0 commit comments