def test_rule_emptying(): """Rule emptying""" r = Rule("/foo", {"meh": "muh"}, "x", ["POST"], False, "x", True, None) r2 = r.empty() assert r.__dict__ == r2.__dict__ r.methods.add("GET") assert r.__dict__ != r2.__dict__ r.methods.discard("GET") r.defaults["meh"] = "aha" assert r.__dict__ != r2.__dict__
def test_rule_emptying(): """Rule emptying""" r = Rule('/foo', {'meh': 'muh'}, 'x', ['POST'], False, 'x', True, None) r2 = r.empty() assert r.__dict__ == r2.__dict__ r.methods.add('GET') assert r.__dict__ != r2.__dict__ r.methods.discard('GET') r.defaults['meh'] = 'aha' assert r.__dict__ != r2.__dict__
def empty(self): new_rule = Rule.empty(self) new_rule.gmg_controller = self.gmg_controller return new_rule