コード例 #1
0
def test_to_usd():
    """
    Tests the to_usd function.
    """
    assert to_usd(1000.2342) == "$1,000.23"
    assert to_usd(100.23) == "$100.23"
    assert to_usd(100.2) == "$100.20"
コード例 #2
0
ファイル: my_test.py プロジェクト: olivermfacon/robo-advisor
def test_to_usd():
    result = to_usd(5)
    assert result == "$5.00"
    result = to_usd(2100.1)
    assert result == "$2,100.10"
    result = to_usd(21.99)
    assert result == "$21.99"
コード例 #3
0
def test_to_usd():

    result = to_usd(40.5)
    assert result == "$40.50"

    result = to_usd(39.19294094)
    assert result == "$39.19"
コード例 #4
0
ファイル: test_advisor.py プロジェクト: cnj14/robo_advisor
def test_to_usd():
    # function should add dollar sign and transform numeric object into string
    assert to_usd(4.50) == '$4.50'
    # function should round to two decimal places
    assert to_usd(4.5) == '$4.50'
    assert to_usd(4.5555) == '$4.56'
    # function should apply commas for numbers greater than 1,000
    assert to_usd(1234567890.5555) == '$1,234,567,890.56'
コード例 #5
0
def test_to_usd():  # to test price formatting
    assert to_usd(18.50) == "$18.50"

    assert to_usd(18.5) == "$18.50"

    assert to_usd(18.5099999) == "$18.51"

    assert to_usd(3195849.65) == "$3,195,849.65"
コード例 #6
0
def test_to_usd():
    result = to_usd(1500)
    assert result == "$1,500.00"

    result = to_usd(98.78384)
    assert result == "$98.78"

    result = to_usd(2.5)
    assert result == "$2.50"
コード例 #7
0
def test_to_usd():  #Taken from executive dashboard testing
    #Tests whether number is returned with $ sign and two decimal places
    assert to_usd(10) == "$10.00"

    #Tests whether number rounds decimal places
    assert to_usd(10.33333333333333) == "$10.33"

    #Tests whether there is a thousand seperator
    assert to_usd(10000) == "$10,000.00"
コード例 #8
0
def test_to_usd():
    assert to_usd(2.5) == "$2.50"

    assert to_usd(2.50) == "$2.50"

    assert to_usd(2.555556) == "$2.56"

    assert to_usd(1234567890.678) == "$1,234,567,890.68"

    assert to_usd(2.555556) == "$2.56"
コード例 #9
0
def test_to_usd():
    # it should apply USD formatting
    assert to_usd(4.50) == "$4.50"

    # it should display two decimal places
    assert to_usd(4.5) == "$4.50"

    # it should round to two places
    assert to_usd(4.55555) == "$4.56"

    # it should display thousands separators
    assert to_usd(1234567890.5555555) == "$1,234,567,890.56"
コード例 #10
0
def test_to_usd():
    #adapted from https://github.com/s2t2/robo-advisor-screencast/blob/v3-testing/test/advisor_test.py
    # it should apply USD formatting
    assert to_usd(4.50) == "$4.50"

    # it should display two decimal places
    assert to_usd(4.5) == "$4.50"

    # it should round to two places
    assert to_usd(4.55555) == "$4.56"

    # it should display thousands separators
    assert to_usd(1234567890.5555555) == "$1,234,567,890.56"
コード例 #11
0
def test_to_usd():
    """
    Tests that the to_usd function correctly reformats price values in US dollars.
    """
    # it should apply USD formatting
    assert to_usd(4.50) == "$4.50"

    # it should display two decimal places
    assert to_usd(4.5) == "$4.50"

    # it should round to two places
    assert to_usd(4.55555) == "$4.56"

    # it should display thousands separators
    assert to_usd(1234567890.5555555) == "$1,234,567,890.56"
コード例 #12
0
ファイル: my_test.py プロジェクト: francesco55/robo-advisor
def test_to_usd():
    """
     tests that to_usd() creates a string from a float that does the following:
              1) converts to two decimals
              2) includes commas for thousands place
              3) includes a dollar sign
     """
    price = 34903.727
    result = to_usd(price)
    assert result == "$34,903.73"
コード例 #13
0
def test_to_usd_isZero():
    result = to_usd(0)
    assert result == '$0.00'
コード例 #14
0
def test_to_usd_isNegative():
    result = to_usd(-1.23)
    assert result == '$-1.23'
コード例 #15
0
def test_to_usd_isLongFloat():
    result = to_usd(1.2345)
    assert result == '$1.23'
コード例 #16
0
def test_to_usd_isFloat():
    result = to_usd(1.23)
    assert result == '$1.23'
コード例 #17
0
def test_to_usd():
    result = to_usd(82.9)
    assert result == "$82.90"
コード例 #18
0
def test_to_usd():
    assert to_usd(5) == "$5.00"
    assert to_usd(0.26) == "$0.26"
    assert to_usd(4.2) == "$4.20"
    assert to_usd(1000) == "$1,000.00"
コード例 #19
0
def test_to_usd():
    assert to_usd(123456.8) == "$123,456.80"
コード例 #20
0
def test_to_usd():
    assert to_usd(4.50) == "$4.50"  #Adds the Dollaer
    assert to_usd(4.5) == "$4.50"  #Has two decimal places
    assert to_usd(4.5555555) == "$4.56"  #should round to two decimal places
    assert to_usd(123456789.5555
                  ) == "$123,456,789.56"  # should display thousand separators
コード例 #21
0
def test_to_usd():
    assert to_usd(5) == "$5.00"
    assert to_usd(5.777) == "$5.78"
    assert to_usd(12345) == "$12,345.00"
コード例 #22
0
def test_to_usd():

    result = to_usd(1223.6)
    assert result == "$1,223.60"
コード例 #23
0
def test_to_usd():
    assert to_usd(3.1415926) == "$3.14"
コード例 #24
0
def test_to_usd_thousandsSeperator():
    result = to_usd(1000)
    assert len(result.split(",")) > 1
コード例 #25
0
def test_to_usd_isSingleDigit():
    result = to_usd(1)
    assert result == '$1.00'
コード例 #26
0
ファイル: my_test.py プロジェクト: tspoon1/robo-advisor
def test_to_usd():
    result = to_usd(5)
    assert result == "$5.00"
コード例 #27
0
ファイル: robo_test.py プロジェクト: funkyman109/robo-advisor
def test_to_usd():
    result = to_usd(3.47)
    assert result == f"${3.47:,.2f}"
コード例 #28
0
def test_to_usd():
    assert to_usd(123123) == "$123,123.00"
コード例 #29
0
ファイル: test_to_usd.py プロジェクト: dhcGU/robo-advisor
def test_usd():
    result = to_usd(4)
    assert result == "$4.00"
コード例 #30
0
def test_to_usd_isDoubleDigit():
    result = to_usd(20)
    assert result == '$20.00'