Did I find the right examples for you? yes no      Crawl my project      Python Jobs

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

src/p/r/Products.MimetypesRegistry-2.0.5/Products/MimetypesRegistry/tests/test_mimetypes.py   Products.MimetypesRegistry(Download)
    def testClassify(self):
        reg = self.registry
        c = reg._classifiers()
        self.failUnless(c[0].name().startswith("Extensible Markup Language"),
                        c[0].name())
 
        #Real XML
        data = "<?xml version='1.0'?><foo>bar</foo>"
        mt = reg.classify(data)
        self.failUnless(isinstance(mt, text_xml), str(mt))
        data = " <?xml version='1.0'?><foo>bar</foo>"
        mt = reg.classify(data)
        self.failUnless(isinstance(mt, text_xml), str(mt))
 
        # also #622: this is not xml
        data = 'xml > plain text'
        mt = reg.classify(data)
        self.failUnless(str(mt) != 'text/xml')
        #Passed in MT
        mt = reg.classify(data, mimetype="text/plain")
        self.failUnless(isinstance(mt, text_plain), str(mt))
 
        #Passed in filename

src/a/r/archetypes.schematuning-1.2/src/archetypes/schematuning/at_tests/test_fields.py   archetypes.schematuning(Download)
            s = field.get_size(dummy)
            size+=s
            self.failUnless(s, 'got: %s, field: %s' % (s, k))
        self.failUnlessEqual(size, dummy.get_size())
 
        errors = {}
        dummy.validate(REQUEST=request, errors=errors)
        self.failUnless(errors, "Errors dictionary is empty.")
        err_fields = errors.keys()
        failures = []

src/p/r/Products.validation-2.0/Products/validation/tests/test_validation.py   Products.validation(Download)
    def test_isUnixLikeName(self):
        v = validation.validatorFor('isUnixLikeName')
        self.failUnlessEqual(v('abcd'), 1)
        self.failUnless(v('a_123456'), 1)
        self.failIfEqual(v('123'), 1)

src/a/r/archetypes.schematuning-1.2/src/archetypes/schematuning/at_tests/test_storage.py   archetypes.schematuning(Download)
        field = dummy.getField('atextfield')
        field.setStorage(dummy, AttributeStorage())
        self.failUnless(hasattr(dummy, 'atextfield'))
        field.setStorage(dummy, MetadataStorage())
        self.failIf(hasattr(dummy, 'atextfield'))
        self.failUnless(dummy._md.has_key('atextfield'))
        field.setStorage(dummy, AttributeStorage())
        self.failIf(dummy._md.has_key('atextfield'))
        self.failUnless(hasattr(dummy, 'atextfield'))