mirror of
https://github.com/kennethreitz/pytheory.git
synced 2026-06-05 06:46:14 +00:00
major updates
This commit is contained in:
@@ -1 +1,3 @@
|
||||
.vscode/settings.json
|
||||
.DS_Store
|
||||
.pytest_cache
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
# pytest cache directory #
|
||||
|
||||
This directory contains data from the pytest's cache plugin,
|
||||
which provides the `--lf` and `--ff` options, as well as the `cache` fixture.
|
||||
|
||||
**Do not** commit this to version control.
|
||||
|
||||
See [the docs](https://docs.pytest.org/en/latest/cache.html) for more information.
|
||||
@@ -8,6 +8,7 @@ pytuning = "*"
|
||||
numeral = "*"
|
||||
|
||||
[dev-packages]
|
||||
pytest = "*"
|
||||
|
||||
[requires]
|
||||
python_version = "3.7"
|
||||
|
||||
Generated
+57
-2
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"_meta": {
|
||||
"hash": {
|
||||
"sha256": "ac018f7f051023c6003e48cdda8b169b48f7f81b587045089fee168037769851"
|
||||
"sha256": "4fa838a86692773eb1959e2b6009ee6f324a3708bc8272e74983e24d30c0a963"
|
||||
},
|
||||
"pipfile-spec": 6,
|
||||
"requires": {
|
||||
@@ -77,5 +77,60 @@
|
||||
"version": "==1.2"
|
||||
}
|
||||
},
|
||||
"develop": {}
|
||||
"develop": {
|
||||
"atomicwrites": {
|
||||
"hashes": [
|
||||
"sha256:0312ad34fcad8fac3704d441f7b317e50af620823353ec657a53e981f92920c0",
|
||||
"sha256:ec9ae8adaae229e4f8446952d204a3e4b5fdd2d099f9be3aaf556120135fb3ee"
|
||||
],
|
||||
"markers": "python_version != '3.2.*' and python_version != '3.3.*' and python_version != '3.1.*' and python_version != '3.0.*' and python_version >= '2.7'",
|
||||
"version": "==1.2.1"
|
||||
},
|
||||
"attrs": {
|
||||
"hashes": [
|
||||
"sha256:10cbf6e27dbce8c30807caf056c8eb50917e0eaafe86347671b57254006c3e69",
|
||||
"sha256:ca4be454458f9dec299268d472aaa5a11f67a4ff70093396e1ceae9c76cf4bbb"
|
||||
],
|
||||
"version": "==18.2.0"
|
||||
},
|
||||
"more-itertools": {
|
||||
"hashes": [
|
||||
"sha256:c187a73da93e7a8acc0001572aebc7e3c69daf7bf6881a2cea10650bd4420092",
|
||||
"sha256:c476b5d3a34e12d40130bc2f935028b5f636df8f372dc2c1c01dc19681b2039e",
|
||||
"sha256:fcbfeaea0be121980e15bc97b3817b5202ca73d0eae185b4550cbfce2a3ebb3d"
|
||||
],
|
||||
"version": "==4.3.0"
|
||||
},
|
||||
"pluggy": {
|
||||
"hashes": [
|
||||
"sha256:6e3836e39f4d36ae72840833db137f7b7d35105079aee6ec4a62d9f80d594dd1",
|
||||
"sha256:95eb8364a4708392bae89035f45341871286a333f749c3141c20573d2b3876e1"
|
||||
],
|
||||
"markers": "python_version != '3.2.*' and python_version != '3.3.*' and python_version != '3.1.*' and python_version != '3.0.*' and python_version >= '2.7'",
|
||||
"version": "==0.7.1"
|
||||
},
|
||||
"py": {
|
||||
"hashes": [
|
||||
"sha256:06a30435d058473046be836d3fc4f27167fd84c45b99704f2fb5509ef61f9af1",
|
||||
"sha256:50402e9d1c9005d759426988a492e0edaadb7f4e68bcddfea586bc7432d009c6"
|
||||
],
|
||||
"markers": "python_version != '3.2.*' and python_version != '3.3.*' and python_version != '3.1.*' and python_version != '3.0.*' and python_version >= '2.7'",
|
||||
"version": "==1.6.0"
|
||||
},
|
||||
"pytest": {
|
||||
"hashes": [
|
||||
"sha256:2d7c49e931316cc7d1638a3e5f54f5d7b4e5225972b3c9838f3584788d27f349",
|
||||
"sha256:ad0c7db7b5d4081631e0155f5c61b80ad76ce148551aaafe3a718d65a7508b18"
|
||||
],
|
||||
"index": "pypi",
|
||||
"version": "==3.7.4"
|
||||
},
|
||||
"six": {
|
||||
"hashes": [
|
||||
"sha256:70e8a77beed4562e7f14fe23a786b54f6296e34344c23bc42f07b15018ff98e9",
|
||||
"sha256:832dc0e10feb1aa2c68dcc57dbb658f1c7e65b9b61af69048abc87a2db00a0eb"
|
||||
],
|
||||
"version": "==1.11.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+8
-3
@@ -99,11 +99,15 @@ class Tone:
|
||||
f"Tone {self.name!r} was not found in system: {self.system.tones!r}"
|
||||
)
|
||||
|
||||
def __repr__(self):
|
||||
@property
|
||||
def full_name(self):
|
||||
if self.octave:
|
||||
return f"<Tone {self.name}{self.octave}>"
|
||||
return f"{self.name}{self.octave}"
|
||||
else:
|
||||
return f"<Tone {self.name}>"
|
||||
return self.name
|
||||
|
||||
def __repr__(self):
|
||||
return f"<Tone {self.full_name}>"
|
||||
|
||||
def __eq__(self, other):
|
||||
|
||||
@@ -296,6 +300,7 @@ class System:
|
||||
if offset:
|
||||
scale = scale[offset - 1 :] + scale[: offset - 1]
|
||||
|
||||
# descending goes in meta?
|
||||
return {"intervals": scale, "hemitonic": hemitonic, "meta": {}}
|
||||
|
||||
def __repr__(self):
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
import pytest
|
||||
|
||||
import pytheory
|
||||
from pytheory import Tone, TonedScale, Tone
|
||||
|
||||
|
||||
def test_tone_from_string():
|
||||
c4 = Tone.from_string("C4")
|
||||
assert c4.name == "C"
|
||||
assert c4.octave == 4
|
||||
|
||||
|
||||
def test_tone_initialization():
|
||||
c4 = Tone(name="C", octave=4)
|
||||
assert c4.name == "C"
|
||||
assert c4.octave == 4
|
||||
|
||||
|
||||
def test_tone_addition():
|
||||
assert (
|
||||
Tone.from_string("C4", system=pytheory.SYSTEMS["western"]).add(12).full_name
|
||||
== "C5"
|
||||
)
|
||||
Reference in New Issue
Block a user