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

All Samples(5)  |  Call(4)  |  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_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_values_representable_as_floats(self):
        self.replay()
        value = Decimal('1.00')
        serialized = serialize_decimals(value)
        deserialized = deserialize_decimals(serialized)
        value = Decimal('1.55')
        serialized = serialize_decimals(value)
        deserialized = deserialize_decimals(serialized)
        self.assertEquals(deserialized, value)
        self.assertEquals(hash(deserialized), hash(value))
                '__type__': 'Decimal',
                'value_str': '1.55'}
        result = deserialize_decimals(data)
        self.assertEquals(result, expected)
        self.assertEquals(hash(result), hash(expected))
    def test_serialize_deserialize_is_idempotent(self):
        self.replay()
        expected = Decimal('7.50')
        serialized = serialize_decimals(expected)
        deserialized = deserialize_decimals(serialized)