def test_EditWithInt( self ): sic = SimpleIntCriterion( 'foo', 'foofield' ) sic.edit( 32 ) self.assertEqual( sic.value, 32 ) self.assertEqual( sic.getValueString(), '32' ) items = sic.getCriteriaItems() self.assertEqual( len(items), 1 ) self.assertEqual( len(items[0]), 2 ) self.assertEqual( items[0][1], 32 )
def test_EditWithInt(self): sic = SimpleIntCriterion('foo', 'foofield') sic.edit(32) self.assertEqual(sic.value, 32) self.assertEqual(sic.getValueString(), '32') items = sic.getCriteriaItems() self.assertEqual(len(items), 1) self.assertEqual(len(items[0]), 2) self.assertEqual(items[0][1], 32)
def test_RangeMax(self): sic = SimpleIntCriterion('foo', 'foofield') sic.edit('32', SimpleIntCriterion.MAXIMUM) self.assertEqual(sic.value, 32) self.assertEqual(sic.getValueString(), '32') items = sic.getCriteriaItems() self.assertEqual(len(items), 1) self.assertEqual(len(items[0]), 2) self.assertEqual(items[0][0], 'foofield') self.assertEqual(items[0][1]['query'], 32) self.assertEqual(items[0][1]['range'], 'max')
def test_RangeMinMax_withTuple(self): sic = SimpleIntCriterion('foo', 'foofield') sic.edit((32, 34), SimpleIntCriterion.MINMAX) self.assertEqual(sic.value, (32, 34)) self.assertEqual(sic.getValueString(), '32 34') items = sic.getCriteriaItems() self.assertEqual(len(items), 1) self.assertEqual(len(items[0]), 2) self.assertEqual(items[0][0], 'foofield') self.assertEqual(items[0][1]['query'], (32, 34)) self.assertEqual(items[0][1]['range'], 'min:max')
def test_RangeMax( self ): sic = SimpleIntCriterion( 'foo', 'foofield' ) sic.edit( '32', SimpleIntCriterion.MAXIMUM ) self.assertEqual( sic.value, 32 ) self.assertEqual( sic.getValueString(), '32' ) items = sic.getCriteriaItems() self.assertEqual( len(items), 1 ) self.assertEqual( len( items[0] ), 2 ) self.assertEqual( items[0][0], 'foofield' ) self.assertEqual( items[0][1]['query'], 32 ) self.assertEqual( items[0][1]['range'], 'max' )
def test_RangeMinMax_withTuple( self ): sic = SimpleIntCriterion( 'foo', 'foofield' ) sic.edit( ( 32, 34 ), SimpleIntCriterion.MINMAX ) self.assertEqual( sic.value, ( 32, 34 ) ) self.assertEqual( sic.getValueString(), '32 34' ) items = sic.getCriteriaItems() self.assertEqual( len(items), 1 ) self.assertEqual( len( items[0] ), 2 ) self.assertEqual( items[0][0], 'foofield' ) self.assertEqual( items[0][1]['query'], ( 32, 34 ) ) self.assertEqual( items[0][1]['range'], 'min:max' )
def test_EditWithString(self): from Products.CMFTopic.SimpleIntCriterion import SimpleIntCriterion sic = SimpleIntCriterion('foo', 'foofield') sic.edit('0') self.assertEqual(sic.value, 0) self.assertEqual(sic.getValueString(), '0') items = sic.getCriteriaItems() self.assertEqual(len(items), 1) self.assertEqual(len(items[0]), 2) self.assertEqual(items[0][0], 'foofield') self.assertEqual(items[0][1], 0)
def test_EditWithString( self ): from Products.CMFTopic.SimpleIntCriterion import SimpleIntCriterion sic = SimpleIntCriterion('foo', 'foofield') sic.edit('0') self.assertEqual( sic.value, 0 ) self.assertEqual( sic.getValueString(), '0' ) items = sic.getCriteriaItems() self.assertEqual( len( items ), 1 ) self.assertEqual( len( items[0] ), 2 ) self.assertEqual( items[0][0], 'foofield' ) self.assertEqual( items[0][1], 0 )
def test_RangeMin_withInt(self): from Products.CMFTopic.SimpleIntCriterion import SimpleIntCriterion sic = SimpleIntCriterion('foo', 'foofield') sic.edit(32, SimpleIntCriterion.MINIMUM) self.assertEqual(sic.value, 32) self.assertEqual(sic.getValueString(), '32') items = sic.getCriteriaItems() self.assertEqual(len(items), 2) self.assertEqual(len(items[0]), 2) self.assertEqual(len(items[1]), 2) self.assertEqual(items[0][0], 'foofield') self.assertEqual(items[0][1], 32) self.assertEqual(items[1][0], 'foofield_usage') self.assertEqual(items[1][1], 'range:min')
def test_RangeMinMax_withTuple(self): from Products.CMFTopic.SimpleIntCriterion import SimpleIntCriterion sic = SimpleIntCriterion('foo', 'foofield') sic.edit((32, 34), SimpleIntCriterion.MINMAX) self.assertEqual(sic.value, (32, 34)) self.assertEqual(sic.getValueString(), '32 34') items = sic.getCriteriaItems() self.assertEqual(len(items), 2) self.assertEqual(len(items[0]), 2) self.assertEqual(len(items[1]), 2) self.assertEqual(items[0][0], 'foofield') self.assertEqual(items[0][1], (32, 34)) self.assertEqual(items[1][0], 'foofield_usage') self.assertEqual(items[1][1], 'range:min:max')
def test_RangeMin_withInt( self ): from Products.CMFTopic.SimpleIntCriterion import SimpleIntCriterion sic = SimpleIntCriterion( 'foo', 'foofield' ) sic.edit( 32, SimpleIntCriterion.MINIMUM ) self.assertEqual( sic.value, 32 ) self.assertEqual( sic.getValueString(), '32' ) items = sic.getCriteriaItems() self.assertEqual( len( items ), 2 ) self.assertEqual( len( items[0] ), 2 ) self.assertEqual( len( items[1] ), 2 ) self.assertEqual( items[0][0], 'foofield' ) self.assertEqual( items[0][1], 32 ) self.assertEqual( items[1][0], 'foofield_usage' ) self.assertEqual( items[1][1], 'range:min' )
def test_RangeMinMax_withTuple( self ): from Products.CMFTopic.SimpleIntCriterion import SimpleIntCriterion sic = SimpleIntCriterion( 'foo', 'foofield' ) sic.edit( ( 32, 34 ), SimpleIntCriterion.MINMAX ) self.assertEqual( sic.value, ( 32, 34 ) ) self.assertEqual( sic.getValueString(), '32 34' ) items = sic.getCriteriaItems() self.assertEqual( len( items ), 2 ) self.assertEqual( len( items[0] ), 2 ) self.assertEqual( len( items[1] ), 2 ) self.assertEqual( items[0][0], 'foofield' ) self.assertEqual( items[0][1], ( 32, 34 ) ) self.assertEqual( items[1][0], 'foofield_usage' ) self.assertEqual( items[1][1], 'range:min:max' )