- Notifications
You must be signed in to change notification settings - Fork750
QuantConnect Update#1385
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Closed
Uh oh!
There was an error while loading.Please reload this page.
Closed
QuantConnect Update#1385
Changes fromall commits
Commits
Show all changes
34 commits Select commitHold shift + click to select a range
062a0bc
Reflect PR #1 Support for Decimal
C-SELLERS5ed5a96
Reflect PR#8 MISSING CONVERTER.CS L516-528 Changes
C-SELLERS9b5445e
Reflect PR #14
C-SELLERS709643a
Reflect PR #15
C-SELLERSa481700
Reflect PR #19
C-SELLERSde0328c
Reflect PR #25
C-SELLERS481f4d0
Reflect PR #34
C-SELLERS863530d
Reflect PR #35
C-SELLERS5839d21
Implement List Conversion, Reflect PR #37 Tests
C-SELLERSc362816
Reflect PR #38 Partial: Assembly Manager Improvements
C-SELLERScde9b51
Reflect PR #38
C-SELLERS101624e
Reflect PR #42 KeyValuePairEnumerableObject
C-SELLERS56a4bcf
Reflect PR #10 Runtime DecimalType
C-SELLERS508db2e
Add TimeDelta and DateTime tests
C-SELLERSebbafad
Fix DecimalConversion test for float conversion
C-SELLERS53375ce
Converter mod tweaks
C-SELLERSc8fdbcb
Adjust a few broken PyTests
C-SELLERSaf30873
Use _pydecimal to not interfere with Lean/decimal.py
C-SELLERSbf1755d
Add MethodBinder tests
C-SELLERS58d5df0
MethodBinder implicit resolution
Martin-Molinero0c94228
Fix bad cherry pick
C-SELLERS44e089a
Refactoring precedence resolution
Martin-Molinero108eacf
Deal with operator binding
C-SELLERS6379568
Fix `TestNoOverloadException` unit test
C-SELLERS9f2796a
Fix for DomainReload tests
C-SELLERSb0aca5c
Add InEquality Operator Test
C-SELLERS0f5f0ba
Dont PyObjects precedence in Operator methods
C-SELLERSed6ab18
Revert "Merge pull request #1240 from danabr/auto-cast-ret-val-to-int…
C-SELLERSd87584b
Fix Primitive Conversion to Int
C-SELLERSf59335f
Post rebase fix
C-SELLERSbd94e49
Add PrimitiveIntConversion test
C-SELLERScd06d10
Add test for interface derived classes
C-SELLERSaeb20c0
Add to Authors.md
C-SELLERSae34f30
Load in current directory into Python Path
C-SELLERSFile filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
2 changes: 2 additions & 0 deletionsAUTHORS.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
5 changes: 0 additions & 5 deletionsCHANGELOG.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
62 changes: 62 additions & 0 deletionssrc/embed_tests/TestConverter.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
76 changes: 76 additions & 0 deletionssrc/embed_tests/TestInterfaceClasses.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
using NUnit.Framework; | ||
using Python.Runtime; | ||
namespace Python.EmbeddingTest | ||
{ | ||
public class TestInterfaceClasses | ||
{ | ||
public string testCode = @" | ||
from clr import AddReference | ||
AddReference(""System"") | ||
AddReference(""Python.EmbeddingTest"") | ||
from Python.EmbeddingTest import * | ||
testModule = TestInterfaceClasses.GetInstance() | ||
print(testModule.Child.ChildBool) | ||
"; | ||
[OneTimeSetUp] | ||
public void SetUp() | ||
{ | ||
PythonEngine.Initialize(); | ||
} | ||
[OneTimeTearDown] | ||
public void Dispose() | ||
{ | ||
PythonEngine.Shutdown(); | ||
} | ||
[Test] | ||
public void TestInterfaceDerivedClassMembers() | ||
{ | ||
// This test gets an instance of the CSharpTestModule in Python | ||
// and then attempts to access it's member "Child"'s bool that is | ||
// not defined in the interface. | ||
PythonEngine.Exec(testCode); | ||
} | ||
public interface IInterface | ||
{ | ||
bool InterfaceBool { get; set; } | ||
} | ||
public class Parent : IInterface | ||
{ | ||
public bool InterfaceBool { get; set; } | ||
public bool ParentBool { get; set; } | ||
} | ||
public class Child : Parent | ||
{ | ||
public bool ChildBool { get; set; } | ||
} | ||
public class CSharpTestModule | ||
{ | ||
public IInterface Child; | ||
public CSharpTestModule() | ||
{ | ||
Child = new Child | ||
{ | ||
ChildBool = true, | ||
ParentBool = true, | ||
InterfaceBool = true | ||
}; | ||
} | ||
} | ||
public static CSharpTestModule GetInstance() | ||
{ | ||
return new CSharpTestModule(); | ||
} | ||
} | ||
} |
121 changes: 121 additions & 0 deletionssrc/embed_tests/TestMethodBinder.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,121 @@ | ||
using System; | ||
using NUnit.Framework; | ||
using Python.Runtime; | ||
namespace Python.EmbeddingTest | ||
{ | ||
public class TestMethodBinder | ||
{ | ||
private static dynamic module; | ||
private static string testModule = @" | ||
from clr import AddReference | ||
AddReference(""System"") | ||
AddReference(""Python.EmbeddingTest"") | ||
from Python.EmbeddingTest import * | ||
class PythonModel(TestMethodBinder.CSharpModel): | ||
def TestA(self): | ||
return self.OnlyString(TestMethodBinder.TestImplicitConversion()) | ||
def TestB(self): | ||
return self.OnlyClass('input string') | ||
def TestC(self): | ||
return self.InvokeModel('input string') | ||
def TestD(self): | ||
return self.InvokeModel(TestMethodBinder.TestImplicitConversion()) | ||
def TestE(self, array): | ||
return array.Length == 2"; | ||
[OneTimeSetUp] | ||
public void SetUp() | ||
{ | ||
PythonEngine.Initialize(); | ||
module = PythonEngine.ModuleFromString("module", testModule).GetAttr("PythonModel").Invoke(); | ||
} | ||
[OneTimeTearDown] | ||
public void Dispose() | ||
{ | ||
PythonEngine.Shutdown(); | ||
} | ||
[Test] | ||
public void ImplicitConversionToString() | ||
{ | ||
var data = (string)module.TestA(); | ||
// we assert implicit conversion took place | ||
Assert.AreEqual("OnlyString impl: implicit to string", data); | ||
} | ||
[Test] | ||
public void ImplicitConversionToClass() | ||
{ | ||
var data = (string)module.TestB(); | ||
// we assert implicit conversion took place | ||
Assert.AreEqual("OnlyClass impl", data); | ||
} | ||
[Test] | ||
public void WillAvoidUsingImplicitConversionIfPossible_String() | ||
{ | ||
var data = (string)module.TestC(); | ||
// we assert no implicit conversion took place | ||
Assert.AreEqual("string impl: input string", data); | ||
} | ||
[Test] | ||
public void WillAvoidUsingImplicitConversionIfPossible_Class() | ||
{ | ||
var data = (string)module.TestD(); | ||
// we assert no implicit conversion took place | ||
Assert.AreEqual("TestImplicitConversion impl", data); | ||
} | ||
[Test] | ||
public void ArrayLength() | ||
{ | ||
var array = new[] { "pepe", "pinocho" }; | ||
var data = (bool)module.TestE(array); | ||
// Assert it is true | ||
Assert.AreEqual(true, data); | ||
} | ||
public class CSharpModel | ||
{ | ||
public virtual string OnlyClass(TestImplicitConversion data) | ||
{ | ||
return "OnlyClass impl"; | ||
} | ||
public virtual string OnlyString(string data) | ||
{ | ||
return "OnlyString impl: " + data; | ||
} | ||
public virtual string InvokeModel(string data) | ||
{ | ||
return "string impl: " + data; | ||
} | ||
public virtual string InvokeModel(TestImplicitConversion data) | ||
{ | ||
return "TestImplicitConversion impl"; | ||
} | ||
} | ||
public class TestImplicitConversion | ||
{ | ||
public static implicit operator string(TestImplicitConversion symbol) | ||
{ | ||
return "implicit to string"; | ||
} | ||
public static implicit operator TestImplicitConversion(string symbol) | ||
{ | ||
return new TestImplicitConversion(); | ||
} | ||
} | ||
} | ||
} |
23 changes: 23 additions & 0 deletionssrc/embed_tests/TestOperator.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
7 changes: 1 addition & 6 deletionssrc/runtime/arrayobject.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Oops, something went wrong.
Uh oh!
There was an error while loading.Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.