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

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

src/p/r/Products.MimetypesRegistry-2.0.5/Products/MimetypesRegistry/tests/test_mimetypes.py   Products.MimetypesRegistry(Download)
        self.failUnless(isinstance(mt, text_xml), str(mt))
        mt = reg.classify(data, filename="test.jpg")
        self.failUnlessEqual(str(mt), 'image/jpeg')
 
        #Passed in uppercase filename
        mt = reg.classify(data, filename="test.JPG")
        self.failUnlessEqual(str(mt), 'image/jpeg')
 
        mt = reg.classify(data, filename="test.tgz")
        self.failUnlessEqual(str(mt), 'application/x-tar')
 
        mt = reg.classify(data, filename="test.tar.gz")
        self.failUnlessEqual(str(mt), 'application/x-tar')
 
        mt = reg.classify(data, filename="test.pdf.gz")
        self.failUnlessEqual(str(mt), 'application/pdf')

src/p/r/Products.AROfficeTransforms-0.11.0/Products/AROfficeTransforms/tests/test_engine.py   Products.AROfficeTransforms(Download)
    def testCall(self):
        self.register()
        data = self.engine('HtmlToText', self.data)
        self.failUnlessEqual(data, "foo")
 
        data = self.engine('FooToBar', self.data)
        self.failUnlessEqual(data, "<b>bar</b>")
    def testConvert(self):
        self.register()
 
        data = self.engine.convert('HtmlToText', self.data)
        self.failUnlessEqual(data.getData(), "foo")
        self.failUnlessEqual(data.getMetadata()['mimetype'], 'text/plain')
        self.failUnlessEqual(data.getMetadata().get('encoding'), None)

src/p/r/Products.validation-2.0/Products/validation/tests/test_validation.py   Products.validation(Download)
    def test_inNumericRange(self):
        v = validation.validatorFor('inNumericRange')
        self.failUnlessEqual(v(10, 1, 20), 1)
        self.failUnlessEqual(v('10', 1, 20), 1)
        self.failUnlessEqual(v(0, 4, 5), u"Validation failed(inNumericRange): '0' out of range(4, 5)")
 
    def test_isDecimal(self):
        v = validation.validatorFor('isDecimal')
        self.failUnlessEqual(v('1.5'), 1)
        self.failUnlessEqual(v('1,5'), 1)

src/a/r/archetypes.schematuning-1.2/src/archetypes/schematuning/at_tests/test_fields.py   archetypes.schematuning(Download)
            size+=s
            self.failUnless(s, 'got: %s, field: %s' % (s, k))
        self.failUnlessEqual(size, dummy.get_size())
 
    def test_validation(self):
 
        # Default
        self.failUnlessEqual(field.Vocabulary(), DisplayList())
        # DisplayList
        field.vocabulary = sampleDisplayList()
        dummy.invalidateSchema()
        self.failUnlessEqual(field.Vocabulary(), sampleDisplayList)
        field.vocabulary = ['e1', 'element2']
        dummy.invalidateSchema()
        self.failUnlessEqual(field.Vocabulary(), sampleDisplayList)
        # 2-Tuples
        field.vocabulary = [('e1', 'e1'), ('element2', 'element2')]
        dummy.invalidateSchema()
        self.failUnlessEqual(field.Vocabulary(), sampleDisplayList)

src/a/r/archetypes.schematuning-1.2/src/archetypes/schematuning/at_tests/test_storage.py   archetypes.schematuning(Download)
        out = ('bla','bla','bla')
 
        self.failUnlessEqual(str(dummy.getAtextfield()), 'sometext')
        self.failUnlessEqual(dummy.getAdatefield(), DateTime('2003-01-01'))
        self.failUnlessEqual(dummy.getAlinesfield(), out)
        self.failUnlessEqual(dummy.getAnobjectfield(), 'someothertext')
                self._old_storages[field.getName()] = field.getStorage()
                field.setStorage(dummy, AttributeStorage())
                self.failUnlessEqual(field.getStorage().getName(), 'AttributeStorage')
                field.setStorage(dummy, MetadataStorage())
                self.failUnlessEqual(field.getStorage().getName(), 'MetadataStorage')

src/p/r/Products.MimetypesRegistry-2.0.5/Products/MimetypesRegistry/tests/test_encoding.py   Products.MimetypesRegistry(Download)
    def testUTF8(self):
        e = guess_encoding('\xef\xbb\xbf any UTF-8 data')
        self.failUnlessEqual(e, 'UTF-8')
        e = guess_encoding(' any UTF-8 data \xef\xbb\xbf')
        self.failUnlessEqual(e, None)
 
    def testEmacs(self):
        e = guess_encoding('# -*- coding: UTF-8  -*-')
        self.failUnlessEqual(e, 'UTF-8')
        ### -*- coding: ISO-8859-1  -*-
        ''')
        self.failUnlessEqual(e, 'ISO-8859-1')
        e = guess_encoding('''
 
        ### -*- coding: ISO-8859-1  -*-
        ''')
        self.failUnlessEqual(e, None)

src/p/r/Products.DigestoContentTypes-1.2a1/Products/DigestoContentTypes/tests/test_validators.py   Products.DigestoContentTypes(Download)
 
        v = validation.validatorFor('is_address_book')
        self.failUnlessEqual(v(valid_address_book), 1)
        self.failIfEqual(v(invalid_address_book1), 1)
        self.failIfEqual(v(invalid_address_book2), 1)
 
        v = validation.validatorFor('is_dossier_number_list')
        self.failUnlessEqual(v(valid_dossier_numbers), 1)
        self.failIfEqual(v(invalid_dossier_numbers1), 1)
        self.failIfEqual(v(invalid_dossier_numbers2), 1)
        v = validation.validatorFor('is_cudap_number')
        for i in valid_cudap_numbers:
            self.failUnlessEqual(v(i), 1, '%s should validate correctly' %str(i))
        for i in invalid_cudap_numbers:
            self.failIfEqual(v(i), 1, '%s should NOT validate' %str(i))

src/p/r/Products.MimetypesRegistry-2.0.5/Products/MimetypesRegistry/tests/test_magic.py   Products.MimetypesRegistry(Download)
            # use method direct
            got = guessMime(data)
            self.failUnlessEqual(got, expected)
 
            # use mtr-tool
            got_from_tool = self.registry.classify(data)
            self.failUnlessEqual(got_from_tool, expected)
                data=data[:8192]
                got_cutted = self.registry.classify(data)
                self.failUnlessEqual(got_cutted, expected)
 
 

src/c/o/collective.itvalidators-1.0.0/collective/itvalidators/tests/test_validation.py   collective.itvalidators(Download)
    def test_isCAP(self):
        v = validation.validatorFor('isCAP')
        self.failUnlessEqual(v('44021'), 1)
        self.failUnlessEqual(v('00100'), 1)
        self.failUnlessEqual(v('010001'),
                             u"Validation failed(isCAP): '010001' is not a valid CAP.")
        self.failUnlessEqual(v('100'),
                             u"Validation failed(isCAP): '100' is not a valid CAP.")
        self.failUnlessEqual(v('44b50'),

src/p/r/Products.DataGridField-1.9.0/Products/DataGridField/tests/testValidators.py   Products.DataGridField(Download)
    def test_registration(self):
        from Products.validation import validation
        v = validation.validatorFor('isDataGridFilled')
        self.failUnlessEqual(v((0, 1)), 1)
        self.failUnlessEqual(v([0, 1]), 1)