mirror of
https://gitee.com/fasiondog/hikyuu.git
synced 2024-11-29 18:39:10 +08:00
unit-test退出时恢复控制台代码页;python 加强 StrategyContext.__init__
This commit is contained in:
parent
2d392565e4
commit
88379f18a4
@ -446,4 +446,18 @@ def Parameter_to_dict(self):
|
||||
Parameter.__iter__ = Parameter_iter
|
||||
Parameter.keys = Parameter_keys
|
||||
Parameter.items = Parameter_items
|
||||
Parameter.to_dict = Parameter_to_dict
|
||||
Parameter.to_dict = Parameter_to_dict
|
||||
|
||||
# ------------------------------------------------------------------
|
||||
# 增强 StrategyContext
|
||||
# ------------------------------------------------------------------
|
||||
__old_StrategyContext_init__ = StrategyContext.__init__
|
||||
|
||||
|
||||
def __new_StrategyContext_init__(self, stock_code_list=None):
|
||||
__old_StrategyContext_init__(self)
|
||||
if stock_code_list is not None:
|
||||
self.stock_list = stock_code_list
|
||||
|
||||
|
||||
StrategyContext.__init__ = __new_StrategyContext_init__
|
@ -53,6 +53,7 @@ void init_hikyuu_test() {
|
||||
int main(int argc, char** argv) {
|
||||
#if defined(_WIN32)
|
||||
// Windows 下设置控制台程序输出代码页为 UTF8
|
||||
auto old_cp = GetConsoleOutputCP();
|
||||
SetConsoleOutputCP(CP_UTF8);
|
||||
#endif
|
||||
|
||||
@ -86,5 +87,9 @@ int main(int argc, char** argv) {
|
||||
int client_stuff_return_code = 0;
|
||||
// your program - if the testing framework is integrated in your production code
|
||||
|
||||
#if defined(_WIN32)
|
||||
SetConsoleOutputCP(old_cp);
|
||||
#endif
|
||||
|
||||
return res + client_stuff_return_code; // the result from doctest is propagated here as well
|
||||
}
|
Loading…
Reference in New Issue
Block a user