@@ -81,7 +81,7 @@ def test_amount_convert_valid_currency(self):
8181
8282 def test_amount_convert_valid_currency_same_currency (self ):
8383 amount = convert ('USD' , 'USD' , 10 )
84- self .assertEqual (amount , 10 )
84+ self .assertEqual (amount , float ( 10 ) )
8585
8686
8787 def test_amount_convert_date (self ):
@@ -106,9 +106,12 @@ def setUp(self):
106106
107107 def test_amount_decimal_convert (self ):
108108 amount = self .c .convert ('USD' , 'INR' , Decimal ('10.45' ))
109-
110109 self .assertTrue (isinstance (amount , Decimal ))
111110
111+ def test_amount_decimal_convert_same_currency (self ):
112+ amount = self .c .convert ('USD' , 'USD' , Decimal ('10.45' ))
113+ self .assertEqual (amount , Decimal ('10.45' ))
114+
112115 def test_amount_decimal_convert_date (self ):
113116 date_obj = datetime .datetime .strptime ('2010-05-10' , "%Y-%m-%d" ).date ()
114117 amount = self .c .convert ('USD' , 'INR' , Decimal ('10.45' ), date_obj )
@@ -145,6 +148,12 @@ def test_decimal_get_rate_with_valid_codes(self):
145148 # check if return value is Decimal
146149 self .assertTrue (isinstance (rate , Decimal ))
147150
151+ def test_decimal_get_rate_with_valid_same_codes (self ):
152+ rate = self .c .get_rate ('USD' , 'USD' )
153+ # check if return value is Decimal
154+ self .assertEqual (rate , Decimal (1 ))
155+
156+
148157 def test_decimal_get_rate_with_date (self ):
149158 date_obj = datetime .datetime .strptime ('2010-05-10' , "%Y-%m-%d" ).date ()
150159 rate = self .c .get_rate ('USD' , 'INR' , date_obj )
0 commit comments