Skip to content

Commit

Permalink
Test weird nested dicts.
Browse files Browse the repository at this point in the history
  • Loading branch information
tonybaloney committed Jul 18, 2024
1 parent f16b6b5 commit ed488ba
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
10 changes: 10 additions & 0 deletions Integration.Tests/BasicTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,5 +59,15 @@ public void TestDicts()
var result = testDicts.TestDictStrInt(testDict);
Assert.Equal(1, result["hello"]);
Assert.Equal(2, result["world"]);


IReadOnlyDictionary<string, IEnumerable<long>> testListDict = new Dictionary<string, IEnumerable<long>> { { "hello", new List<long> { 1, 2, 3 } }, { "world", new List<long> { 4, 5, 6 } } };
var result2 = testDicts.TestDictStrListInt(testListDict);
Assert.Equal([1, 2, 3], result2["hello"]);
Assert.Equal([4, 5, 6], result2["world"]);

IReadOnlyDictionary<string, IReadOnlyDictionary<string, long>> testDictDict = new Dictionary<string, IReadOnlyDictionary<string, long>> { { "hello", new Dictionary<string, long> { { "world", 1 } } } };
var result3 = testDicts.TestDictStrDictInt(testDictDict);
Assert.Equal(1, result3["hello"]["world"]);
}
}
5 changes: 5 additions & 0 deletions Integration.Tests/python/test_dicts.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
def test_dict_str_int(a: dict[str, int]) -> dict[str, int]:
return a

def test_dict_str_list_int(a: dict[str, list[int]]) -> dict[str, list[int]]:
return a

def test_dict_str_dict_int(a: dict[str, dict[str, int]]) -> dict[str, dict[str, int]]:
return a

0 comments on commit ed488ba

Please sign in to comment.