def test_tuplize(self): assert (tuplize('string', 'one two three') == ('one', 'two', 'three')) assert (tuplize('string', 'one,two,three', comma_split) == ('one', 'two', 'three')) assert (tuplize('list', ['one', ' two', 'three ']) == ('one', ' two', 'three ')) assert (tuplize('tuple', ('one', 'two', 'three')) == ('one', 'two', 'three'))
def test_tuplize(self): wanted = ('one', 'two', 'three') self.assertEqual(tuplize('string', 'one two three'), wanted) self.assertEqual(tuplize('unicode', u'one two three'), wanted) self.assertEqual(tuplize('string', 'one,two,three', comma_split), wanted) self.assertEqual(tuplize('list', ['one', ' two', 'three ']), wanted) self.assertEqual(tuplize('tuple', ('one', 'two', 'three')), wanted)
def test_tuplize(self): wanted = ('one','two','three') self.assertEqual( tuplize('string', 'one two three'), wanted ) self.assertEqual( tuplize('unicode', u'one two three'), wanted ) self.assertEqual( tuplize('string', 'one,two,three', comma_split), wanted ) self.assertEqual( tuplize('list', ['one',' two','three ']), wanted ) self.assertEqual( tuplize('tuple', ('one','two','three')), wanted )
def test_tuplize(self): from Products.CMFDefault.utils import comma_split from Products.CMFDefault.utils import tuplize wanted = ('one', 'two', 'three') self.assertEqual(tuplize('string', 'one two three'), wanted) self.assertEqual(tuplize('unicode', u'one two three'), wanted) self.assertEqual(tuplize('string', 'one,two,three', comma_split), wanted) self.assertEqual(tuplize('list', ['one', ' two', 'three ']), wanted) self.assertEqual(tuplize('tuple', ('one', 'two', 'three')), wanted)
def test_tuplize(self): from Products.CMFDefault.utils import comma_split from Products.CMFDefault.utils import tuplize wanted = ('one','two','three') self.assertEqual( tuplize('string', 'one two three'), wanted ) self.assertEqual( tuplize('unicode', u'one two three'), wanted ) self.assertEqual( tuplize('string', 'one,two,three', comma_split), wanted ) self.assertEqual( tuplize('list', ['one',' two','three ']), wanted ) self.assertEqual( tuplize('tuple', ('one','two','three')), wanted )
def setSubject(self, subject): subject = tuplize('subject', subject) s = [] for part in subject: if isinstance(part, str): part = part.decode('utf-8') s.append(part) self.subject = tuple(s)
def setCreators(self, creators): creators = tuplize('creators', creators) s = [] for part in creators: if isinstance(part, str): part = part.decode('utf-8') s.append(part) self.creators = tuple(s)
def setSubject( self, subject ): """ Set Dublin Core Subject element - resource keywords. """ self.subject = tuplize( 'subject', subject )
def setCreators(self, creators): """ Set Dublin Core Creator elements - resource authors. """ self.creators = tuplize('creators', creators)
def test_tuplize( self ): assert( tuplize('string', 'one two three') == ('one','two','three')) assert( tuplize('string', 'one,two,three', comma_split) == ('one','two','three')) assert( tuplize('list', ['one',' two','three ']) == ('one',' two','three ')) assert( tuplize('tuple', ('one','two','three')) == ('one','two','three'))
def setVersions(self, versions): """OMF version elements.""" self.versions = tuplize('versions', versions, semi_split)
def setCoverages(self, coverages): """OMF coverage elements.""" self.coverages = tuplize('coverages', coverages, semi_split)
def setAuthors(self, authors): """OMF creator elements.""" self.authors = tuplize('authors', authors, semi_split)
def setSources(self, sources): """OMF source elements.""" self.sources = tuplize('sources', sources, semi_split)
def setIdentifiers(self, identifiers): """OMF identifier elements.""" self.identifiers = tuplize('identifiers', identifiers, semi_split)
def setFormats(self, formats): """OMF format elements.""" self.formats = tuplize('formats', formats, semi_split)
def setTypes(self, types): """OMF type elements.""" self.types = tuplize('types', types, semi_split)
def setContributors( self, contributors ): """ Set Dublin Core Contributor elements - resource collaborators. """ # XXX: fixme self.contributors = tuplize('contributors', contributors, semi_split)
def setRelations(self, relations): """OMF relation elements.""" self.relations = tuplize('relations', relations, semi_split)
def setMaintainers(self, maintainers): """OMF maintainer elements.""" self.maintainers = tuplize('maintainers', maintainers, semi_split)