Build Project Structure.
New: base classes and modules. New: unit tests.
This commit is contained in:
parent
dba4698ad4
commit
9481e6fcaa
0
__init__.py
Normal file
0
__init__.py
Normal file
0
core/__init__.py
Normal file
0
core/__init__.py
Normal file
2
core/base/ResultBase.py
Normal file
2
core/base/ResultBase.py
Normal file
@ -0,0 +1,2 @@
|
||||
class ResultBase():
|
||||
pass
|
9
core/base/SimulationBase.py
Normal file
9
core/base/SimulationBase.py
Normal file
@ -0,0 +1,9 @@
|
||||
import abc
|
||||
|
||||
|
||||
class SimulationBase():
|
||||
@abc.abstractclassmethod
|
||||
def run(self):
|
||||
pass
|
||||
|
||||
pass
|
2
core/base/__init__.py
Normal file
2
core/base/__init__.py
Normal file
@ -0,0 +1,2 @@
|
||||
from .ResultBase import ResultBase
|
||||
from .SimulationBase import SimulationBase
|
0
tests/__init__.py
Normal file
0
tests/__init__.py
Normal file
18
tests/test_base.py
Normal file
18
tests/test_base.py
Normal file
@ -0,0 +1,18 @@
|
||||
import unittest
|
||||
|
||||
from haocrowd.core.base import SimulationBase
|
||||
|
||||
|
||||
class TestBase(unittest.TestCase):
|
||||
|
||||
def test_basic(self):
|
||||
class MySim(SimulationBase):
|
||||
def run(self) -> str:
|
||||
return "HelloSim"
|
||||
|
||||
mysim = MySim()
|
||||
self.assertEqual(mysim.run(), "HelloSim")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
Loading…
Reference in New Issue
Block a user