def test_allows(self):
        """ Does the allow method filter names appropriately?
        """
        context = NameFilterContext(names=['foo'])

        self.assertTrue(context.allows(1,'foo'))
        self.assertFalse(context.allows(1,'bar'))
    def test_allows(self):
        """ Does the allow method filter names appropriately?
        """
        context = NameFilterContext(names=['foo'])

        self.assertTrue(context.allows(1, 'foo'))
        self.assertFalse(context.allows(1, 'bar'))
    def test_set_allowed_name(self):
        """ Does the context accept names that aren't in its name list?
        """
        context = NameFilterContext(names=['foo'])

        context['foo'] = 1
        self.assertEqual(context['foo'], 1)
        self.assertFalse(context.allows(1,'bar'))
    def test_set_allowed_name(self):
        """ Does the context accept names that aren't in its name list?
        """
        context = NameFilterContext(names=['foo'])

        context['foo'] = 1
        self.assertEqual(context['foo'], 1)
        self.assertFalse(context.allows(1, 'bar'))