Changeset 12331


Ignore:
Timestamp:
28 Dec 2014, 07:53:48 (10 years ago)
Author:
Henrik Bettermann
Message:

We have to meet the entire interface when creating a new ProductOption? instance from string. We cannozt expect that string in import files are marked unicode.

Location:
main/waeup.ikoba/trunk/src/waeup/ikoba/products
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.ikoba/trunk/src/waeup/ikoba/products/productoptions.py

    r12328 r12331  
    7373        try:
    7474            fee = Decimal(fee)
     75            title = unicode(title)
     76            currency = unicode(currency)
    7577        except TypeError:
    7678            pass
  • main/waeup.ikoba/trunk/src/waeup/ikoba/products/tests/test_productoptions.py

    r12327 r12331  
    6565        myinput = u"(u'%s',u'%s',u'%s')" % (
    6666            self.valid_title, self.valid_fee, self.valid_currency)
     67        myinput2 = u"('%s','%s','%s')" % (
     68            self.valid_title, self.valid_fee, self.valid_currency)
    6769        item1 = ProductOption.from_string(myinput)
    6870        item2 = ProductOption.from_string(u"(u'', u'', u'')")
    6971        item3 = ProductOption.from_string(u"(None, None, None)")
     72        item4 = ProductOption.from_string(myinput2)
    7073        self.assertEqual(item1.title, self.valid_title)
    7174        self.assertEqual(item1.fee, self.valid_fee)
     
    7780        self.assertTrue(item3.fee is None)
    7881        self.assertEqual(item3.currency, None)
     82        self.assertEqual(item4.title, self.valid_title)
     83        self.assertEqual(item4.fee, self.valid_fee)
     84        self.assertEqual(item4.currency, self.valid_currency)
    7985        return
    8086
Note: See TracChangeset for help on using the changeset viewer.