

@run_with_all_backends
def test_parent_case_lookup(self):
    with _with_case(self.domain, 'test-child-case-type', datetime(2016, 1, 1)) as child, _with_case(self.domain, 'test-parent-case-type', datetime(2016, 1, 1), case_name='abc') as parent:
        child = set_parent_case(self.domain, child, parent)
        rule = AutomaticUpdateRule(domain=self.domain, name='test-parent-rule', case_type='test-child-case-type', active=True, server_modified_boundary=30)
        rule.save()
        self.addCleanup(rule.delete)
        rule.automaticupdaterulecriteria_set = [AutomaticUpdateRuleCriteria(property_name='parent/name', property_value='abc', match_type=AutomaticUpdateRuleCriteria.MATCH_EQUAL)]
        self.assertTrue(rule.rule_matches_case(child, datetime(2016, 3, 1)))
        rule.automaticupdaterulecriteria_set.all().delete()
        rule.automaticupdaterulecriteria_set = [AutomaticUpdateRuleCriteria(property_name='parent/name', property_value='def', match_type=AutomaticUpdateRuleCriteria.MATCH_EQUAL)]
        self.assertFalse(rule.rule_matches_case(self, datetime(2016, 3, 1)))

dataset/ETHPy150Open dimagi/commcare-hq/corehq/apps/data_interfaces/tests/test_auto_case_updates.py AutomaticCaseUpdateTest.test_parent_case_lookup/VarMisuse@202/319 `child`->`self`