def test_view_setattr_machinery(attr, subset_func, subset_func2):
    # Tests that setting attributes on a view doesn't mess anything up too bad
    adata = gen_adata((10, 10))
    view = adata[subset_func(adata.obs_names), subset_func2(adata.var_names)]

    actual = view.copy()
    setattr(view, attr, getattr(actual, attr))
    assert_equal(actual, view, exact=True)
def render(self, context):
        try:
            if self.params:
                params = template.Variable(self.params).resolve(context)
            else:
                params = {}

            # try matching an address string literal
            email_literal = self.email.strip().lower()
            if EMAIL_RE.match(email_literal):
                email = email_literal
            # treat as a variable
            else:
                email = template.Variable(self.email).resolve(context)
        except template.VariableDoesNotExist:
            return ''

        # now, we generate the gravatar url
        return _build_gravatar_url(email, params)