Environment
- Pythonnet version: master/3.0
- Python version: *
- Operating System: *
- .NET Runtime: *
Details
- Describe what you were trying to get done.
Seems that since CollectionMixinsProvider was added this case started failing (if key in collection.Keys:), not sure why CollectionMixinsProvider is required, if this is a bug or not..
Test passes commenting out https://github.com/pythonnet/pythonnet/blob/master/src/runtime/InteropConfiguration.cs#L24
class ATests
{
private static dynamic containsTest;
private static string testModule = @"
from clr import AddReference
AddReference(""System"")
AddReference(""Python.EmbeddingTest"")
def ContainsTest(key, collection):
if key in collection.Keys:
return True
return False
";
[OneTimeSetUp]
public void Setup()
{
PythonEngine.Initialize();
var pyModule = PyModule.FromString("module", testModule);
containsTest = pyModule.GetAttr("ContainsTest");
}
[TestCase("AAPL", false)]
[TestCase("SPY", true)]
public void ContainsTest(string key, bool expected)
{
var dic = new Dictionary<string, object> { { "SPY", new object() } };
Assert.AreEqual(expected, (bool)containsTest(key, dic));
}
}
Environment
Details
Seems that since
CollectionMixinsProviderwas added this case started failing (if key in collection.Keys:), not sure whyCollectionMixinsProvideris required, if this is a bug or not..Test passes commenting out https://github.com/pythonnet/pythonnet/blob/master/src/runtime/InteropConfiguration.cs#L24
Minimal, Complete, and Verifiable example
this will help us understand the issue.