Added the test module and refined the code

This commit is contained in:
Maximilien Rigaut 2019-05-01 16:30:36 +02:00
parent f22b0c7840
commit 67d80e5980
4 changed files with 33 additions and 5 deletions

3
.gitmodules vendored Normal file
View File

@ -0,0 +1,3 @@
[submodule "minitest"]
path = minitest
url = https://github.com/Malphaet/minitest.git

View File

@ -1,17 +1,20 @@
class BasicMessageParse(object):
"""Classic System Specific Midi Message as Hex (BasicSyHexParse)."""
"""Classic System Specific Midi Message as Hex (BasicSyHexParse).
Uses one method, parseMidi to parse the message and return a BasicMapping object with the mapping of the message inside"""
def __init__(self):
'''Basic init'''
self.type=None #Witch type of message it is, witch to choose from
self.mapping={"value":None,"type":None} # A barebone initialisation, unusable, it will need to be overridden to work
self.value=None
self.
def parseMidi(self,message):
"""Take a midi SyxEx message and return a BasicParse"""
"""Take a midi SyxEx message and return a BasicMapping"""
pass
class BasicParser(object):
"""A message with accesible properties and a reading manual"""
class BasicMapping(object):
"""A basic reading of the message, propreties are initialised depending on the way the SyEx message is formed,
this objet will need the configuration to read and understand the message
"""
def __init__(self):
pass

21
mapping/mapping.py Normal file
View File

@ -0,0 +1,21 @@
class BasicMessageParse(object):
"""Classic System Specific Midi Message as Hex (BasicSyHexParse).
Uses one method, parseMidi to parse the message and return a BasicMapping object with the mapping of the message inside"""
def __init__(self):
'''Basic init'''
self._mapping={"value":None,"type":None} # A barebone initialisation, unusable, it will need to be overridden to work
def parseMidi(self,message):
"""Take a midi SyxEx message and return a BasicMapping (there can be many children of BasicMapping to take more properly care of the cases)"""
return BasicMapping(self._mapping)
class BasicMapping(object):
"""A basic reading of the message, propreties are initialised depending on the way the SyEx message is formed,
this objet will need the configuration to read and understand the message
"""
def __init__(self,dictmapping):
'Barebone init'
self._mapping=dictmapping
def

1
minitest Submodule

@ -0,0 +1 @@
Subproject commit 11a1157bd86f0166e43445ab137bb483ec85d71f