LinearMap.len is wrong
This does not return the number of entries in the map. I'm guessing that it instead returns capacity.
Looking at the code, it should return the number of entries contained in the map. It definitely doesn't return the capacity but maybe does something wrong while tracking the entry count.
Looked at the code myself. Wasn't clear at first what's going on, but after looking at it more closely expand seems wrong: each time through it's going to increment size by the old capacity.
Yeah, you're right. This needs to reset self.size to zero before copying the old entries to their new buckets.
Fixed.