Did I find the right examples for you? yes no

All Samples(9)  |  Call(9)  |  Derive(0)  |  Import(0)

src/o/b/obfuscate-0.2.2/testsuite.py   obfuscate(Download)
    def testConstructor(self):
        """Test that we can instantiate the subclass."""
        inst = self.Subclass('key')
        self.failUnless(isinstance(inst, self.Subclass))
    def testTokens(self):
        """Test that instances have token attributes."""
        inst = self.Subclass('key')
    def testInstanceMakeTokens(self):
        inst = self.Subclass('key')
        methods = ('make_encryption_token', 'make_decryption_token')
        for methodname in methods:
            result = self.getMethodResult(inst, methodname, 'key')
        for methodname in methods:
            # Test the instance.
            method = getattr(self.Subclass("key"), methodname)
            self.assertEquals(method(None), "key")
            self.assertEquals(method("altkey"), "altkey")
    def testEncrypt(self):
        """Test the encrypt method."""
        self.assertEquals(self.Subclass.encrypt("spam", "key"), "keyspam")
        instance = self.Subclass("password")
        self.assertEquals(instance.encrypt("spam"), "passwordspam")