Add python syntax check (#8651)
API Tests / build (push) Has been cancelled
Benchmarks / build (push) Has been cancelled
Build & Test Lean / build (push) Has been cancelled
Regression Tests / build (push) Has been cancelled
Report Generator Tests / build (push) Has been cancelled
Research Regression Tests / build (push) Has been cancelled
Syntax Tests / build (push) Has been cancelled
Python Virtual Environments / build (push) Has been cancelled
API Tests / build (push) Has been cancelled
Benchmarks / build (push) Has been cancelled
Build & Test Lean / build (push) Has been cancelled
Regression Tests / build (push) Has been cancelled
Report Generator Tests / build (push) Has been cancelled
Research Regression Tests / build (push) Has been cancelled
Syntax Tests / build (push) Has been cancelled
Python Virtual Environments / build (push) Has been cancelled
* Add python syntax check * Fix some python regression algorithms * Fixing more bugs
This commit is contained in:
@@ -43,14 +43,14 @@ class PythonDictionaryFeatureRegressionAlgorithm(QCAlgorithm):
|
||||
slice_bars = ', '.join([f'{x}' for x in slice.bars.values()])
|
||||
|
||||
if "SPY" not in slice:
|
||||
raise Exception('SPY (string) is not in Slice')
|
||||
raise AssertionError('SPY (string) is not in Slice')
|
||||
|
||||
if self.spy_symbol not in slice:
|
||||
raise Exception('SPY (Symbol) is not in Slice')
|
||||
raise AssertionError('SPY (Symbol) is not in Slice')
|
||||
|
||||
spy = slice.get(self.spy_symbol)
|
||||
if spy is None:
|
||||
raise Exception('SPY is not in Slice')
|
||||
raise AssertionError('SPY is not in Slice')
|
||||
|
||||
for symbol, bar in slice.bars.items():
|
||||
self.plot(symbol, 'Price', bar.close)
|
||||
@@ -61,18 +61,18 @@ class PythonDictionaryFeatureRegressionAlgorithm(QCAlgorithm):
|
||||
leverages = ', '.join([str(x.get_last_data()) for x in self.securities.values()])
|
||||
|
||||
if "IBM" not in self.securities:
|
||||
raise Exception('IBM (string) is not in Securities')
|
||||
raise AssertionError('IBM (string) is not in Securities')
|
||||
|
||||
if self.ibm_symbol not in self.securities:
|
||||
raise Exception('IBM (Symbol) is not in Securities')
|
||||
raise AssertionError('IBM (Symbol) is not in Securities')
|
||||
|
||||
ibm = self.securities.get(self.ibm_symbol)
|
||||
if ibm is None:
|
||||
raise Exception('ibm is None')
|
||||
raise AssertionError('ibm is None')
|
||||
|
||||
aapl = self.securities.get(self.aapl_symbol)
|
||||
if aapl is not None:
|
||||
raise Exception('aapl is not None')
|
||||
raise AssertionError('aapl is not None')
|
||||
|
||||
for symbol, security in self.securities.items():
|
||||
self.plot(symbol, 'Price', security.price)
|
||||
@@ -82,18 +82,18 @@ class PythonDictionaryFeatureRegressionAlgorithm(QCAlgorithm):
|
||||
leverages = ', '.join([f'{x.symbol}: {x.leverage}' for x in self.portfolio.values()])
|
||||
|
||||
if "AIG" not in self.securities:
|
||||
raise Exception('AIG (string) is not in Portfolio')
|
||||
raise AssertionError('AIG (string) is not in Portfolio')
|
||||
|
||||
if self.aig_symbol not in self.securities:
|
||||
raise Exception('AIG (Symbol) is not in Portfolio')
|
||||
raise AssertionError('AIG (Symbol) is not in Portfolio')
|
||||
|
||||
aig = self.portfolio.get(self.aig_symbol)
|
||||
if aig is None:
|
||||
raise Exception('aig is None')
|
||||
raise AssertionError('aig is None')
|
||||
|
||||
aapl = self.portfolio.get(self.aapl_symbol)
|
||||
if aapl is not None:
|
||||
raise Exception('aapl is not None')
|
||||
raise AssertionError('aapl is not None')
|
||||
|
||||
for symbol, holdings in self.portfolio.items():
|
||||
msg = f'{symbol}: {holdings.leverage}'
|
||||
@@ -109,7 +109,7 @@ class PythonDictionaryFeatureRegressionAlgorithm(QCAlgorithm):
|
||||
bar = self.securities.pop("SPY")
|
||||
length = len(self.securities)
|
||||
if length != 2:
|
||||
raise Exception(f'After popping SPY, Securities should have 2 elements, {length} found')
|
||||
raise AssertionError(f'After popping SPY, Securities should have 2 elements, {length} found')
|
||||
|
||||
securities_copy = self.securities.copy()
|
||||
self.securities.clear() # Does not throw
|
||||
|
||||
Reference in New Issue
Block a user