Make `len` work for `ICollection<>` interface objects by danabr · Pull Request #1253 · pythonnet/pythonnet
def test_len_through_interface_generic(): """Test __len__ for ICollection<T>""" import System.Collections.Generic l = System.Collections.Generic.List[int]() coll = System.Collections.Generic.ICollection[int](l) assert len(coll) == 0
def test_len_through_interface(): """Test __len__ for ICollection""" import System.Collections l = System.Collections.ArrayList() coll = System.Collections.ICollection(l) assert len(coll) == 0