# Path: sitegeist/formatting.py
# TWOPLACES = Decimal("0.01")
# def dec2curr(d, whole=False):
# def dec2num(d, whole=False):
# def dec2pct(d, raw=False, whole=False):
# 
# Path: sitegeist/utils.py
# def age2ym(age):


from decimal import Decimal
from sitegeist import formatting, utils
import unittest


class FormattersTestCase(unittest.TestCase):

    def test_dec2pct(self):

        d = Decimal("0.232385436346")
        s = formatting.dec2pct(d)
        self.assertEqual(s, "23.24%")

        d = Decimal("23.3023234235")
        s = formatting.dec2pct(d, raw=True)
        self.assertEqual(s, "23.30%")

    def test_dec2num(self):

        d = Decimal("23.235235")
        s = formatting.dec2num(d)
        self.assertEqual(s, "23.24")

        d = Decimal("23456.308")
        s = formatting.dec2num(d)
        self.assertEqual(s, "23,456.31")


# Path: sitegeist/formatting.py
# TWOPLACES = Decimal("0.01")
# def dec2curr(d, whole=False):
# def dec2num(d, whole=False):
# def dec2pct(d, raw=False, whole=False):
# 
# Path: sitegeist/utils.py
# def age2ym(age):


# Path: sitegeist/tests.py
from decimal import Decimal
from sitegeist import formatting, utils
import unittest



class FormattersTestCase(unittest.TestCase):

    def test_dec2pct(self):

        d = Decimal("0.232385436346")
        s = formatting.dec2pct(d)
        self.assertEqual(s, "23.24%")

        d = Decimal("23.3023234235")
        s = formatting.dec2pct(d, raw=True)
        self.assertEqual(s, "23.30%")

    def test_dec2num(self):

        d = Decimal("23.235235")
        s = formatting.dec2num(d)
        self.assertEqual(s, "23.24")

        d = Decimal("23456.308")
        s = formatting.dec2num(d)
        self.assertEqual(s, "23,456.31")


        s = formatting.dec2num(d, whole=True)