Navigation

    Backtrader Community

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    For code/output blocks: Use ``` (aka backtick or grave accent) in a single line before and after the block. See: http://commonmark.org/help/

    unit testing strategies

    General Code/Help
    2
    2
    546
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • D
      dongiulio last edited by

      Hello,

      I'm trying to unit test my strategy, but I'm finding it hard to obtain an instantiated object for my Strategy class,

      these classes are supposed to be instantiated directly by Cerebro, so if I try instantiating them directly I get:

       *** AttributeError: 'NoneType' object has no attribute '_next_stid'
      

      on the other side, cerebro seems to hold only an uninstantiated version of the class, how could I get an instantiated Strategy Object so that I could unit test its methods?

      Thanks,

      1 Reply Last reply Reply Quote 0
      • B
        backtrader administrators last edited by

        You cannot. The testing approach is result based not unit based.

        1 Reply Last reply Reply Quote 0
        • 1 / 1
        • First post
          Last post
        Copyright © 2016, 2017, 2018, 2019, 2020, 2021 NodeBB Forums | Contributors