Whole file

yuma-m/pychord

The author described this change as Fix inversion qualities. It counts as a record because the checks below fail on the code as it stood at b5b6b33d7 and pass on ffe4f09f3, with nothing else changed between the two runs.

Fix saved2022-06-13
Sharing licenceMIT · LICENSE
Change size+5 1

What the code was meant to do, written into the code itself as a save note

Fix inversion qualities

The change

11 import copy
2+import math
23 from collections import OrderedDict
34 from typing import Tuple, List
45
104105 q = copy.deepcopy(self._qualities[name])
105106 # apply requested inversion :
106107 for i in range(inversion):
107- q.components = tuple(q.components[1:] + tuple([q.components[0]]))
108+ n = q.components[0]
109+ while n < q.components[-1]:
110+ n += 12
111+ q.components = q.components[1:] + (n,)
108112 return q
109113
110114 def set_quality(self, name: str, components: Tuple[int, ...]):

The check that tells the two apart

failpass·test/test_component.py::TestChordComponentWithPitch::test_fifth_order_inversion
failpass·test/test_component.py::TestChordComponentWithPitch::test_first_order_inversion
failpass·test/test_component.py::TestChordComponentWithPitch::test_fourth_order_inversion
failpass·test/test_component.py::TestChordComponentWithPitch::test_second_order_inversion
failpass·test/test_component.py::TestChordComponentWithPitch::test_third_order_inversion

Check file test/test_component.py, taken without changes from the fix and copied onto the older code, so the exact same check runs against both versions.

Origin and history

The code before itb5b6b33d7a68924cf981ede3e3be98deb8d5d269
Broken version dated2022-06-13
Modulepychord.quality
Units changedQualityManager
Fingerprinta6f88b01ec387b90
Checked2026-08-18 by goldset/0.1

Every field above is generated by our program. None of it is written by hand.