def test_cleanup_fringe(self): w_a = self.space.newutf8("a", 1) w_b = self.space.newutf8("b", 1) w_c = self.space.newutf8("c", 1) w_d = self.space.newutf8("d", 1) base = Terminator(self.space) base.instantiation_count = 6 m1 = base.get_next(w_a, 'a"', 0, 2, base) m2 = base.get_next(w_b, 'b"', 0, 2, base) m3 = base.get_next(w_c, 'c"', 0, 2, base) m4 = base.get_next(w_d, 'd"', 0, 2, base) m5 = m4.get_next(w_a, 'a"', 0, 2, base) base.instantiation_count = 7 m1.instantiation_count = 2 m2.instantiation_count = 2 m3.instantiation_count = 2 m4.instantiation_count = 1 m5.instantiation_count = 1 assert base.current_fringe == dict.fromkeys([m1, m2, m3, m4]) base.cleanup_fringe() assert base.current_fringe == dict.fromkeys([m1, m2, m3]) assert m4.state == MapBase.BLOCKED assert m4.nextmap_first is None assert m4.nextmap_all is None assert m5.state == MapBase.BLOCKED assert m5.nextmap_first is None assert m5.nextmap_all is None
def _make_some_maps(self): # base -> m1 -> m2 -> m3 # \-> m4 w_a = self.space.newutf8("a", 1) w_b = self.space.newutf8("b", 1) w_c = self.space.newutf8("c", 1) w_d = self.space.newutf8("d", 1) base = Terminator(self.space) base.instantiation_count = 6 m1 = base.get_next(w_a, 'a"', 0, 2, base) m2 = m1.get_next(w_b, 'b"', 0, 2, base) m3 = m2.get_next(w_c, 'c"', 0, 2, base) m4 = m2.get_next(w_d, 'd"', 0, 2, base) return base, m1, m2, m3, m4