def test_numeric(self):

        prec = decimal.getcontext().prec

        self.compare(
            decimal.Decimal(10 ** 20), force_bytes("100000000000000000000``%i" % prec)
        )
        self.compare(decimal.Decimal("100"), force_bytes("100``%i" % prec))
        self.compare(decimal.Decimal("100.00"), force_bytes("100.00``%i" % prec))
        self.compare(decimal.Decimal("0.010"), force_bytes("0.010``%i" % prec))
        self.compare(decimal.Decimal("0.1534"), force_bytes("0.1534``%i" % prec))
        self.compare(decimal.Decimal("0.0000000010"), force_bytes("0.0000000010``%i" % prec))

        self.compare(decimal.Decimal("0"), force_bytes("0``%i" % prec))
        self.compare(decimal.Decimal("0.0"), force_bytes("0.0``%i" % prec))
        self.compare(decimal.Decimal("0.0000000000"), force_bytes("0.0000000000``%i" % prec))

        self.compare(fractions.Fraction(1, 2), wl.Rational(1, 2))

        self.compare(float("0.150000"), b"0.15")

        for special, result in (
            [float("inf"), self.dumps(wl.DirectedInfinity(1))],
            [float("-inf"), self.dumps(wl.DirectedInfinity(-1))],
            [float("nan"), self.dumps(wl.Indeterminate)],
        ):
            self.compare(special, result)
            self.compare(decimal.Decimal(special), result)
    def test_numeric(self):

        prec = decimal.getcontext().prec

        self.compare(
            decimal.Decimal(10**20),
            force_bytes(u'100000000000000000000``%i' % prec))
        self.compare(decimal.Decimal('100'), force_bytes(u'100``%i' % prec))
        self.compare(
            decimal.Decimal('100.00'), force_bytes(u'100.00``%i' % prec))
        self.compare(
            decimal.Decimal('0.010'), force_bytes(u'0.010``%i' % prec))
        self.compare(
            decimal.Decimal('0.1534'), force_bytes(u'0.1534``%i' % prec))
        self.compare(
            decimal.Decimal('0.0000000010'),
            force_bytes(u'0.0000000010``%i' % prec))

        self.compare(decimal.Decimal('0'), force_bytes(u'0``%i' % prec))
        self.compare(decimal.Decimal('0.0'), force_bytes(u'0.0``%i' % prec))
        self.compare(
            decimal.Decimal('0.0000000000'),
            force_bytes(u'0.0000000000``%i' % prec))

        self.compare(fractions.Fraction(1, 2), wl.Rational(1, 2))

        self.compare(float('0.150000'), b'0.15')

        for special, result in (
            [float('inf'), self.dumps(wl.DirectedInfinity(1))],
            [float('-inf'), self.dumps(wl.DirectedInfinity(-1))],
            [float('nan'), self.dumps(wl.Indeterminate)],
        ):
            self.compare(special, result)
            self.compare(decimal.Decimal(special), result)