def METHOD_NAME(self):
    # Validate IP network enforcement
    data = {"var1": "1.2.3"}
    form = IPAddressWithMaskVarJob().as_form(data)
    self.assertFalse(form.is_valid())
    self.assertIn("var1", form.errors)
    # Validate IP mask requirement
    data = {"var1": "192.0.2.0"}
    form = IPAddressWithMaskVarJob().as_form(data)
    self.assertFalse(form.is_valid())
    self.assertIn("var1", form.errors)
    # Validate valid data
    data = {"var1": "192.0.2.0/24"}
    form = IPAddressWithMaskVarJob().as_form(data)
    self.assertTrue(form.is_valid())
    self.assertEqual(form.cleaned_data["var1"], IPNetwork(data["var1"]))