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

All Samples(6)  |  Call(5)  |  Derive(0)  |  Import(1)

src/f/t/ftw.publisher.core-2.4.0/ftw/publisher/core/tests/test_shop_item_adapter.py   ftw.publisher.core(Download)
from ftw.publisher.core.adapters.shop_items import make_serializable
from ftw.publisher.core.adapters.shop_items import make_persistent
from ftw.publisher.core.adapters.shop_items import serialize_decimals
from ftw.publisher.core.adapters.shop_items import deserialize_decimals
from decimal import Decimal
    def test_serialized_structure(self):
        self.replay()
        dec = Decimal('1.01')
        result = serialize_decimals(dec)
        self.assertEquals(result['__ftw_publisher_serialized_obj__'], True)
    def test_values_representable_as_floats(self):
        self.replay()
        value = Decimal('1.00')
        serialized = serialize_decimals(value)
        deserialized = deserialize_decimals(serialized)
        # this value here
        value = Decimal('1.55')
        serialized = serialize_decimals(value)
        deserialized = deserialize_decimals(serialized)
        self.assertEquals(deserialized, value)
    def test_serializing_recurses(self):
        self.replay()
        data = [Decimal('1.55'), {'foo': [Decimal('1.0')]}]
        result = serialize_decimals(data)
        self.assertIsInstance(result[0], dict)