Repository: joke2k/faker

Issue:
Some currency symbols missing from currency provider
* Faker version: v4.0.1 onwards
* OS: Archlinux

Some currencies do not have any symbols associated with them.

### Steps to reproduce

```
from faker import Faker
fake = Faker()
currency = fake.currency()  # returns ("GGP", "Guernsey pound")
currency = ("GGP", "Guernsey pound")
symbol = fake.currency_symbol(code=currency[0])
print(symbol)
```

### Expected behavior

```
# should print the pound sign
'£'
```

### Actual behavior

```
faker/providers/currency/__init__.py", line 326, in currency_symbol
    return self.currency_symbols[code]
 KeyError: 'GGP'
```


Some currency symbols missing from currency provider
* Faker version: v4.0.1 onwards
* OS: Archlinux

Some currencies do not have any symbols associated with them.

### Steps to reproduce

```
from faker import Faker
fake = Faker()
currency = fake.currency()  # returns ("GGP", "Guernsey pound")
currency = ("GGP", "Guernsey pound")
symbol = fake.currency_symbol(code=currency[0])
print(symbol)
```

### Expected behavior

```
# should print the pound sign
'£'
```

### Actual behavior

```
faker/providers/currency/__init__.py", line 326, in currency_symbol
    return self.currency_symbols[code]
 KeyError: 'GGP'
```




Discussion:
Thanks for the report. Feel free to submit a PR to test and fix this.
Yes, I’ll do !
Thanks for the report. Feel free to submit a PR to test and fix this.
Yes, I’ll do !

Resolving patch:
diff --git a/faker/providers/currency/__init__.py b/faker/providers/currency/__init__.py
--- a/faker/providers/currency/__init__.py
+++ b/faker/providers/currency/__init__.py
@@ -221,88 +221,173 @@ class Provider(BaseProvider):
         ("ADA", "Cardano"),
     )
 
-    # List of currency symbols in Unicode, source: https://www.unicode.org/charts/beta/nameslist/n_20A0.html
+    # List of currency symbols
+    # source: https://en.wikipedia.org/wiki/Currency_symbol
     currency_symbols: Dict[str, str] = {
+        "AED": "\u002e\u062f\u002e\u0625",
         "AFN": "\u060B",
+        "ALL": "Lek",
+        "AMD": "\u058F",
         "ANG": "\u0192",
+        "AOA": "Kz",
         "ARS": "\u0024",
         "AUD": "\u0024",
         "AWG": "\u0192",
+        "AZN": "\u20bc",
+        "BAM": "KM",
         "BBD": "\u0024",
         "BDT": "\u09F3",
+        "BGN": "Lev",
+        "BHD": "\u062F\u0628",
+        "BIF": "Fr",
         "BMD": "\u0024",
         "BND": "\u0024",
         "BOB": "\u0024",
         "BRL": "\u0024",
         "BSD": "\u0024",
+        "BTN": "Nu",
+        "BWP": "P",
+        "BYR": "R",
         "BZD": "\u0024",
         "CAD": "\u0024",
+        "CDF": "Fr",
+        "CHF": "Fr",
         "CLP": "\u0024",
         "CNY": "\u00A5",
         "COP": "\u0024",
         "CRC": "\u20A1",
+        "CUC": "\u0024",
         "CUP": "\u0024",
         "CVE": "\u0024",
+        "CZK": "\u004b\u010d\u0073",
+        "DJF": "Fr",
+        "DKK": "kr",
         "DOP": "\u0024",
+        "DZD": "\u062f\u062c\u200e",
         "EGP": "\u00A3",
+        "ERN": "Nfk",
+        "ETB": "Br",
         "EUR": "\u20AC",
         "FJD": "\u0024",
         "FKP": "\u00A3",
         "GBP": "\u00A3",
+        "GEL": "\u20BE",
+        "GGP": "\u00A3",
         "GHS": "\u20B5",
         "GIP": "\u00A3",
+        "GMD": "D",
+        "GNF": "FG",
+        "GTQ": "Q",
         "GYD": "\u0024",
         "HKD": "\u0024",
-        "HUF": "\u0192",
-        "IDR": "\u20A8",
+        "HNL": "L",
+        "HRK": "kn",
+        "HTG": "G",
+        "HUF": "Ft",
+        "IDR": "Rp",
         "ILS": "\u20AA",
+        "IMP": "\u00A3",
         "INR": "\u20B9",
+        "IQD": "\u062F\u0639",
         "IRR": "\uFDFC",
+        "ISK": "kr",
+        "JEP": "\u00A3",
         "JMD": "\u0024",
+        "JOD": "JD",
         "JPY": "\u00A5",
+        "KES": "KSh",
+        "KGS": "\u20C0",
         "KHR": "\u17DB",
+        "KMF": "FC",
         "KPW": "\u20A9",
         "KRW": "\u20A9",
+        "KWD": "KD",
         "KYD": "\u0024",
         "KZT": "\u20B8",
         "LAK": "\u20AD",
         "LBP": "\u00A3",
         "LKR": "\u20A8",
         "LRD": "\u0024",
+        "LSL": "M",
+        "LTL": "L",
+        "LYD": "LD",
+        "MAD": "Dhs",
+        "MDL": "leu",
+        "MGA": "Ar",
+        "MKD": "DEN",
+        "MMK": "Ks",
         "MNT": "\u20AE",
         "MOP": "\u0024",
+        "MRO": "UM",
         "MUR": "\u20A8",
+        "MVR": "\u0078",
+        "MWK": "K",
         "MXN": "\u0024",
+        "MYR": "RM",
+        "MZN": "Mt",
         "NAD": "\u0024",
         "NGN": "\u20A6",
         "NIO": "\u0024",
+        "NIS": "\u20AA",
+        "NOK": "kr",
         "NPR": "\u20A8",
         "NZD": "\u0024",
         "OMR": "\uFDFC",
+        "PAB": "B/",
+        "PEN": "S/",
+        "PGK": "K",
         "PHP": "\u20B1",
         "PKR": "\u20A8",
+        "PLN": "\u007a\u0142",
         "PYG": "\u20B2",
         "QAR": "\uFDFC",
+        "RON": "leu",
+        "RSD": "\u0434\u0438\u043d",
         "RUB": "\u20BD",
+        "RWF": "F",
         "SAR": "\uFDFC",
         "SBD": "\u0024",
+        "SCR": "\u20A8",
         "SDG": "\u00A3",
+        "SEK": "kr",
         "SGD": "\u0024",
         "SHP": "\u00A3",
+        "SLL": "Le",
+        "SOS": "Sh.So.",
+        "SPL": "L",
         "SRD": "\u0024",
+        "STD": "Db",
+        "SVC": "\u20A1",
         "SYP": "\u00A3",
+        "SZL": "E",
         "THB": "\u0E3F",
-        "TOP": "\u0024",
+        "TJS": "SM",
+        "TMT": "m",
+        "TND": "DT",
+        "TOP": "\u00a2",
         "TRY": "\u20BA",
         "TTD": "\u0024",
+        "TVD": "\u0024",
         "TWD": "\u0024",
+        "TWD": "\u0024",
+        "TZS": "Tsh",
         "UAH": "\u20B4",
+        "UGX": "USh",
         "USD": "\u0024",
-        "UY": "\u0024",
+        "UYU": "\u0024",
+        "UZS": "\u043b\u0432",
+        "VEF": "\u0042\u0073",
         "VND": "\u20AB",
+        "VUV": "VT",
         "WST": "\u0024",
+        "XAF": "Fr",
         "XCD": "\u0024",
+        "XDR": "SDR",
+        "XOF": "Fr",
+        "XPF": "Fr",
         "YER": "\uFDFC",
+        "ZAR": "R",
+        "ZMW": "K",
         "ZWD": "\u0024",
     }
 
@@ -323,7 +408,9 @@ def currency_symbol(self, code: Optional[str] = None) -> str:
         """
         if code is None:
             code = self.random_element(self.currency_symbols.keys())
-        return self.currency_symbols[code]
+        elif code not in [currency[0] for currency in self.currencies]:
+            raise KeyError("The supplied code is not valid")
+        return self.currency_symbols.get(code, "\u00A4")
 
     def cryptocurrency(self) -> Tuple[str, str]:
         return self.random_element(self.cryptocurrencies)


Test patch:
diff --git a/tests/providers/test_currency.py b/tests/providers/test_currency.py
--- a/tests/providers/test_currency.py
+++ b/tests/providers/test_currency.py
@@ -34,6 +34,12 @@ def test_currency_name(self, faker, num_samples):
             name = faker.currency_name()
             assert isinstance(name, str) and name in self.currency_names
 
+    def test_currency_code_has_symbol(self, faker, num_samples):
+        for _ in range(num_samples):
+            code = faker.currency_code()
+            symbol = faker.currency_symbol(code=code)
+            assert isinstance(symbol, str)
+
     def test_currency_symbol_no_code_supplied(self, faker, num_samples):
         for _ in range(num_samples):
             symbol = faker.currency_symbol()