def test_mismatch_does_not_implement(self): obj = ProxyFactory(object(), checker=NamesChecker()) matcher = ProvidesAndIsProxied(ITestInterface) self.assertIsInstance(matcher.match(obj), DoesNotProvide)
def test_mismatch_unproxied(self): obj = Implementor() matcher = ProvidesAndIsProxied(ITestInterface) self.assertIsInstance(matcher.match(obj), IsNotProxied)
def test_match(self): obj = ProxyFactory( Implementor(), checker=NamesChecker(names=("doFoo", ))) matcher = ProvidesAndIsProxied(ITestInterface) self.assertThat(obj, matcher) self.assertEqual(None, matcher.match(obj))
def test_mismatch_does_not_implement(self): obj = ProxyFactory(object(), checker=NamesChecker()) matcher = ProvidesAndIsProxied(ITestInterface) self.assertIsInstance(matcher.match(obj), DoesNotProvide)
def test_mismatch_unproxied(self): obj = Implementor() matcher = ProvidesAndIsProxied(ITestInterface) self.assertIsInstance(matcher.match(obj), IsNotProxied)
def test_match(self): obj = ProxyFactory( Implementor(), checker=NamesChecker(names=("doFoo", ))) matcher = ProvidesAndIsProxied(ITestInterface) self.assertThat(obj, matcher) self.assertEqual(None, matcher.match(obj))