24 lines
686 B
Python
24 lines
686 B
Python
import unittest
|
|
|
|
from equicompiler_algebraic_portfolio_dsl_to_.core import parse_dsl_to_ir
|
|
|
|
|
|
class TestGoCStructure(unittest.TestCase):
|
|
def test_goC_structure_present(self):
|
|
dsl = (
|
|
"assets: AAPL, MSFT, GOOG\n"
|
|
"objectives: maximize_return\n"
|
|
"constraints: max_drawdown=0.2, var=0.95"
|
|
)
|
|
ir = parse_dsl_to_ir(dsl)
|
|
self.assertIn("graph_of_contracts", ir)
|
|
goC = ir["graph_of_contracts"]
|
|
self.assertIsInstance(goC, dict)
|
|
self.assertIn("version", goC)
|
|
self.assertIn("metadata", goC)
|
|
self.assertIn("generated_at", goC["metadata"])
|
|
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main()
|