Fix Leonard notation to use superscript parentheses for brightness

This commit is contained in:
Jonathan Harker 2024-09-23 11:32:34 +12:00
parent 066477755d
commit 77bbc71214
2 changed files with 9 additions and 9 deletions

View file

@ -167,7 +167,7 @@ class SetClass(list):
sub = subscript(self.adjacency_intervals[i]) sub = subscript(self.adjacency_intervals[i])
pitches += f"{pitch}{sub}" pitches += f"{pitch}{sub}"
sup = superscript(self.brightness) sup = superscript(self.brightness)
return f"[{pitches}]{sup}" return f"[{pitches}]{sup}"
# Class methods ----------------------------------------------------------- # Class methods -----------------------------------------------------------

View file

@ -72,18 +72,18 @@ def test_brightest_form():
b = f520.brightest_form b = f520.brightest_form
assert b in f520.versions assert b in f520.versions
assert b == SetClass(0, 4, 5, 9, 10) assert b == SetClass(0, 4, 5, 9, 10)
assert b.leonard_notation == '[0₄4₁5₄9₁10₂]²⁸' assert b.leonard_notation == '[0₄4₁5₄9₁10₂]²⁸'
def test_darkest_form(): def test_darkest_form():
d = f520.darkest_form d = f520.darkest_form
assert d in f520.versions assert d in f520.versions
assert d == SetClass(0, 1, 3, 7, 8) assert d == SetClass(0, 1, 3, 7, 8)
assert d.leonard_notation == '[0₁1₂3₄7₁8₄]¹⁹' assert d.leonard_notation == '[0₁1₂3₄7₁8₄]¹⁹'
def test_leonard_notation(): def test_leonard_notation():
assert f520.leonard_notation == '[0₁1₄5₁6₂8₄]²⁰' assert f520.leonard_notation == '[0₁1₄5₁6₂8₄]²⁰'
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
@ -122,18 +122,18 @@ def test_complement_brightest_form():
b = f520.complement.brightest_form b = f520.complement.brightest_form
assert b in f520.complement.versions assert b in f520.complement.versions
assert b == SetClass(0, 3, 5, 6, 7, 10, 11) assert b == SetClass(0, 3, 5, 6, 7, 10, 11)
assert b.leonard_notation == '[0₃3₂5₁6₁7₃10₁11₁]⁴²' assert b.leonard_notation == '[0₃3₂5₁6₁7₃10₁11₁]⁴²'
def test_complement_darkest_form(): def test_complement_darkest_form():
d = f520.complement.darkest_form d = f520.complement.darkest_form
assert d in f520.complement.versions assert d in f520.complement.versions
assert d == SetClass(0, 1, 2, 5, 6, 7, 10) assert d == SetClass(0, 1, 2, 5, 6, 7, 10)
assert d.leonard_notation == '[0₁1₁2₃5₁6₁7₃10₂]³¹' assert d.leonard_notation == '[0₁1₁2₃5₁6₁7₃10₂]³¹'
def test_complement_leonard_notation(): def test_complement_leonard_notation():
assert f520.complement.leonard_notation == '[0₁1₁2₃5₂7₁8₁9₃]³²' assert f520.complement.leonard_notation == '[0₁1₁2₃5₂7₁8₁9₃]³²'
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
@ -188,7 +188,7 @@ def test_empty_dozenal_notation():
def test_empty_leonard_notation(): def test_empty_leonard_notation():
assert empty.leonard_notation == '[]' assert empty.leonard_notation == '[]⁽⁰⁾'
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
@ -247,7 +247,7 @@ def test_empty_complement_dozenal_notation():
def test_empty_complement_leonard_notation(): def test_empty_complement_leonard_notation():
assert f121.leonard_notation == '[0₁1₁2₁3₁4₁5₁6₁7₁8₁9₁10₁11₁]⁶⁶' assert f121.leonard_notation == '[0₁1₁2₁3₁4₁5₁6₁7₁8₁9₁10₁11₁]⁶⁶'
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------