Ejemplo n.º 1
0
    def test_coerce_to_uint32_price(self, field, expected):
        coerced = coerce_to_uint32(
            array([0.001, 1, 100, 100.5, 1000.005], dtype=float64),
            field,
            DEFAULT_SCALING_FACTORS[field],
        )

        assert_equal(coerced, expected)
Ejemplo n.º 2
0
    def test_coerce_to_uint32_price(self, field, expected):
        # NOTE: 130.23 is not perfectly representable as a double, but we
        # shouldn't truncate and be off by an entire cent
        coerced = coerce_to_uint32(
            array([0.001, 1, 100, 100.5, 1000.005, 130.23], dtype=float64),
            DEFAULT_SCALING_FACTORS[field],
        )

        assert_equal(coerced, expected)
Ejemplo n.º 3
0
    def test_coerce_to_uint32_price(self, field, expected):
        # NOTE: 130.23 is not perfectly representable as a double, but we
        # shouldn't truncate and be off by an entire cent
        coerced = coerce_to_uint32(
            array([0.001, 1, 100, 100.5, 1000.005, 130.23], dtype=float64),
            DEFAULT_SCALING_FACTORS[field],
        )

        assert_equal(coerced, expected)