Files
Alexandre Catarino 521b3335fa Throw clear error when add_data first argument is not a custom data class (#9473)
* Throw clear error when AddData is called with a non-class first argument from Python

Calls like self.add_data("VIX", Resolution.DAILY) routed through CreateType, which
silently built a dynamic assembly named after the string and returned a fake type
whose activator factory tried to invoke the str like a function. The downstream
'str' object is not callable PythonException surfaced confusingly (and could
manifest as an apparent hang depending on where it was caught), making the actual
mistake hard to diagnose.

Validate the PyObject up front via TryCreateType in the AddData(PyObject, ...)
entry points and throw an ArgumentException pointing the user at AddEquity /
AddForex / etc. when the argument is not a custom data class.

* Improve the error message

Use only two alternative methods as examples, as we don't need an exhaustive list.
2026-05-12 11:44:40 -03:00
..
2026-04-20 18:22:39 -03:00
2024-07-10 14:17:27 -03:00
2024-01-05 16:57:19 -03:00

QuantConnect Testing

Before starting any testing, follow the installation instructions to get LEAN running C# algorithms in your machine. For any Python related tests please ensure you have followed the setup as described here.

If the above installation, build, and initial run was successful than we can move forward to testing.

Visual Studio:

Locating Tests

  • Open Visual Studios
  • Open Test Explorer ("Test" > "Test Explorer")
  • The list should populate itself as it reads all the tests it found during the build process. If not, press "Run All Tests" and let VS find all of the tests.
  • From here select the tests you would like to run and begin running them.

Failed Test Logs

  • On a failed test, check the test for information by clicking on the desired test and selecting "Open Additional Output"
  • This will show the stack trace and where the code failed to meet the testing requirements.

Common Problems

Having .NetFramework issues with testing?

Missing dependencies for Python Algorithm?

  • Use pip or conda to install the module.