やってみる

アウトプットすべく己を導くためのブログ。その試行錯誤すらたれ流す。

Scaleクラス修正に伴い純正律クラスの修正をした

D Major Scaleの構成音はD, E, F#, G, A, B, C#

成果物

GitHubPython.MusicTheory.JustIntonation.Scale.201709241330

前回まで

今回

Scaleクラス修正に伴い純正律クラスの修正をした。

JustIntonation.pyにてScale.KeyでなくScale.Key.PitchClassを参照するようにした。

以下のテストでScale, ScaleKeyクラスの循環参照に気づいたため弱参照にして解決した。

./src/TestJustIntonation.py

======================================================================
FAIL: test_init_set (__main__.TestJustIntonation)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "TestJustIntonation.py", line 55, in test_init_set
    print(j.Scale)
AssertionError: ReferenceError not raised

./src/MusicTheory/scale/ScaleKey.py

self.__scale = weakref.proxy(scale)
#self.__scale = scale
テストコード 項目数
TestJustIntonation.py 7
TestScale.py, TestScaleKey.py 14

テスト計165項目。

所感

ほかにも不備があるかもしれない。少し見直してみよう。