Repository: MicroPyramid/forex-python

Issue:
identity get_rate
It would be nice that the conversion from one currency to itself also work
```
>>> c.get_rate("CHF", "CHF")
Traceback (most recent call last):
  File "<input>", line 1, in <module>
  File "/home/user/.virtualenvs/tool/local/lib/python2.7/site-packages/forex_python/converter.py", line 67, in get_rate
    base_cur, dest_cur, date_str))
RatesNotAvailableError: Currency Rate CHF => CHF not available for Date latest
```

Discussion:

Patch:
diff --git a/forex_python/converter.py b/forex_python/converter.py
index bcc8348..316f0cf 100644
--- a/forex_python/converter.py
+++ b/forex_python/converter.py
@@ -56,6 +56,8 @@ class CurrencyRates(Common):
         raise RatesNotAvailableError("Currency Rates Source Not Ready")
 
     def get_rate(self, base_cur, dest_cur, date_obj=None):
+        if base_cur == dest_cur:
+            return 1.
         date_str = self._get_date_string(date_obj)
         payload = {'base': base_cur, 'symbols': dest_cur}
         source_url = self._source_url() + date_str


Test patch:
diff --git a/tests/test.py b/tests/test.py
index 040ed75..2501aa9 100644
--- a/tests/test.py
+++ b/tests/test.py
@@ -50,6 +50,11 @@ class TestGetRate(TestCase):
 
         # check if return value is float
         self.assertTrue(isinstance(rate, float))
+    
+    def test_get_rate_with_valid_codes_same_currency(self):
+        rate = get_rate('USD', 'USD')
+        # rate should be 1.
+        self.assertEqual(1., rate)
 
     def test_get_rate_with_date(self):
         date_obj = datetime.datetime.strptime('2010-05-10', "%Y-%m-%d").date()