Repository: joke2k/faker

Issue:
sv_SE curreny provider missing
There are currently no provider for sv_SE handeling currencies.



Discussion:

Resolving patch:
diff --git a/faker/providers/currency/sv_SE/__init__.py b/faker/providers/currency/sv_SE/__init__.py
new file mode 100644
--- /dev/null
+++ b/faker/providers/currency/sv_SE/__init__.py
@@ -0,0 +1,178 @@
+from .. import Provider as CurrencyProvider
+
+# Names taken from https://www.iban.se/currency-codes
+
+
+class Provider(CurrencyProvider):
+    # Format: (code, name)
+    currencies = (
+        ("AED", "UAE Dirham"),
+        ("AFN", "Afghani"),
+        ("ALL", "Lek"),
+        ("AMD", "Armenisk Dram"),
+        ("ANG", "Gulden från Nederländska Antillerna"),
+        ("AOA", "Kwanza"),
+        ("ARS", "Argentinsk Peso"),
+        ("AUD", "Australisk Dollar"),
+        ("AWG", "Arubisk Florin"),
+        ("AZN", "Azerbajdzjansk Manat"),
+        ("BAM", "Konvertibel Mark"),
+        ("BBD", "Barbadosdollar"),
+        ("BDT", "Taka"),
+        ("BGN", "Bulgarisk Lev"),
+        ("BHD", "Bahraini Dinar"),
+        ("BIF", "Burundi-franc"),
+        ("BMD", "Bermuda-dollar"),
+        ("BND", "Brunei-dollar"),
+        ("BOB", "Boliviano"),
+        ("BOV", "Mvdol"),
+        ("BRL", "Brasilisk Real"),
+        ("BSD", "Bahamasdollar"),
+        ("BTN", "Ngultrum"),
+        ("BWP", "Pula"),
+        ("BYR", "Vitrysk Rubel"),
+        ("BZD", "Belize-dollar"),
+        ("CAD", "Kanadensisk Dollar"),
+        ("CDF", "Kongolesisk Franc"),
+        ("CHE", "WIR Euro"),
+        ("CHF", "Schweizerfranc"),
+        ("CHW", "WIR Franc"),
+        ("CLF", "Unidad de Fomento"),
+        ("CLP", "Chilensk Peso"),
+        ("CNY", "Yuan Renminbi"),
+        ("COP", "Colombiansk Peso"),
+        ("COU", "Unidad de Valor Real"),
+        ("CRC", "Costa Ricansk Colon"),
+        ("CUC", "Peso Convertible"),
+        ("CUP", "Kubansk Peso"),
+        ("CVE", "Kap Verde Escudo"),
+        ("CZK", "Tjeckisk Koruna"),
+        ("DJF", "Djibouti-franc"),
+        ("DKK", "Dansk Krone"),
+        ("DOP", "Dominicansk Peso"),
+        ("DZD", "Algerisk Dinar"),
+        ("EGP", "Egyptiskt pund"),
+        ("ERN", "Nakfa"),
+        ("ETB", "Etiopisk Birr"),
+        ("EUR", "Euro"),
+        ("FJD", "Fiji Dollar"),
+        ("FKP", "Pund från Falklandöarna"),
+        ("GBP", "Pund Sterling"),
+        ("GEL", "Lari"),
+        ("GHS", "Ghana Cedi"),
+        ("GIP", "Gibraltar-pund"),
+        ("GMD", "Dalasi"),
+        ("GNF", "Guinea-franc"),
+        ("GTQ", "Quetzal"),
+        ("GYD", "Guyana-dollar"),
+        ("HKD", "Hong Kong-dollar"),
+        ("HNL", "Lempira"),
+        ("HRK", "Kuna"),
+        ("HTG", "Gourde"),
+        ("HUF", "Forint"),
+        ("IDR", "Rupiah"),
+        ("ILS", "Ny Israelisk Shekel"),
+        ("INR", "Indisk Rupie"),
+        ("IQD", "Irakisk Dinar"),
+        ("IRR", "Iransk Rial"),
+        ("ISK", "Isländsk Krona"),
+        ("JMD", "Jamaica-dollar"),
+        ("JOD", "Jordanisk Dinar"),
+        ("JPY", "Yen"),
+        ("KES", "Kenyansk Shilling"),
+        ("KGS", "Som"),
+        ("KHR", "Riel"),
+        ("KMF", "Comoros-franc"),
+        ("KPW", "Nordkoreansk Won"),
+        ("KRW", "Won"),
+        ("KWD", "Kuwaiti Dinar"),
+        ("KYD", "Caymanöar-dollar"),
+        ("KZT", "Tenge"),
+        ("LAK", "Kip"),
+        ("LBP", "Libanesiskt pund"),
+        ("LKR", "Sri Lanka Rupie"),
+        ("LRD", "Liberiansk Dollar"),
+        ("LSL", "Loti"),
+        ("LYD", "Libysk Dinar"),
+        ("MAD", "Marockansk Dirham"),
+        ("MDL", "Moldavisk Leu"),
+        ("MGA", "Malagasy Ariary"),
+        ("MKD", "Denar"),
+        ("MMK", "Kyat"),
+        ("MNT", "Tugrik"),
+        ("MOP", "Pataca"),
+        ("MRO", "Ouguiya"),
+        ("MUR", "Mauritius Rupie"),
+        ("MVR", "Rufiyaa"),
+        ("MWK", "Kwacha"),
+        ("MXN", "Mexikansk Peso"),
+        ("MXV", "Mexikansk Unidad de Inversion (UDI)"),
+        ("MYR", "Malaysisk Ringgit"),
+        ("MZN", "Mozambique Metical"),
+        ("NAD", "Namibia Dollar"),
+        ("NGN", "Naira"),
+        ("NIO", "Cordoba Oro"),
+        ("NOK", "Norsk Krone"),
+        ("NOK", "Norwegian Krone"),
+        ("NPR", "Nepalesisk Rupie"),
+        ("NZD", "Nya Zealand-dollar"),
+        ("OMR", "Rial Omani"),
+        ("PAB", "Balboa"),
+        ("PEN", "Nuevo Sol"),
+        ("PGK", "Kina"),
+        ("PHP", "Filippinsk Peso"),
+        ("PKR", "Pakistansk Rupie"),
+        ("PLN", "Zloty"),
+        ("PYG", "Guarani"),
+        ("QAR", "Qatari Rial"),
+        ("RON", "Rumänsk Leu"),
+        ("RSD", "Serbisk Dinar"),
+        ("RUB", "Rysk Rubel"),
+        ("RWF", "Rwanda Franc"),
+        ("SAR", "Saudi Riyal"),
+        ("SBD", "Dollar från Salomonöarna"),
+        ("SCR", "Seychell-rupie"),
+        ("SDG", "Sudanesiskt pund"),
+        ("SEK", "Svensk Krona"),
+        ("SGD", "Singapore Dollar"),
+        ("SHP", "Saint Helena pund"),
+        ("SLL", "Leone"),
+        ("SOS", "Somalisk Shilling"),
+        ("SRD", "Surinam Dollar"),
+        ("SSP", "Sydsudanesiskt pund"),
+        ("STD", "Dobra"),
+        ("SVC", "El Salvador Colon"),
+        ("SYP", "Syriskt pund"),
+        ("SZL", "Lilangeni"),
+        ("THB", "Baht"),
+        ("TJS", "Somoni"),
+        ("TMT", "Turkmenistansk Ny Manat"),
+        ("TND", "Tunisisk Dinar"),
+        ("TOP", "Pa’anga"),
+        ("TRY", "Turkisk Lira"),
+        ("TTD", "Trinidad och Tobago Dollar"),
+        ("TWD", "Ny Taiwanesisk Dollar"),
+        ("TZS", "Tanzanisk Shilling"),
+        ("UAH", "Hryvnia"),
+        ("UGX", "Uganda Shilling"),
+        ("USD", "US Dollar"),
+        ("USN", "US Dollar (Nästa dag)"),
+        ("UYI", "Uruguay Peso en Unidades Indexadas (URUIURUI)"),
+        ("UYU", "Peso Uruguayo"),
+        ("UZS", "Uzbekistansk Sum"),
+        ("VEF", "Bolivar"),
+        ("VND", "Dong"),
+        ("VUV", "Vatu"),
+        ("WST", "Tala"),
+        ("XAF", "CFA Franc BEAC"),
+        ("XCD", "East Caribbean Dollar"),
+        ("XDR", "SDR (Särskild dragningsrätt)"),
+        ("XOF", "CFA Franc BCEAO"),
+        ("XPF", "CFP Franc"),
+        ("XSU", "Sucre"),
+        ("XUA", "ADB Beräkningsenhet"),
+        ("YER", "Yemeni Rial"),
+        ("ZAR", "Rand"),
+        ("ZMW", "Zambian Kwacha"),
+        ("ZWL", "Zimbabwe Dollar"),
+    )


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
@@ -110,3 +110,25 @@ def test_currency_name(self, faker, num_samples):
         for _ in range(num_samples):
             name = faker.currency_name()
             assert name in self.currency_names
+
+
+class TestSvSe:
+    """Test sv_SE currency provider"""
+    num_samples = 100
+
+    @classmethod
+    def setup_class(cls):
+        from faker.providers.currency.sv_SE import Provider as SvSeCurrencyProvider
+        cls.provider = SvSeCurrencyProvider
+        cls.currencies = cls.provider.currencies
+        cls.currency_codes, cls.currency_names = tuple(zip(*cls.currencies))
+
+    def test_currency(self, faker, num_samples):
+        for _ in range(num_samples):
+            cur = faker.currency()
+            assert cur in self.currencies
+
+    def test_currency_name(self, faker, num_samples):
+        for _ in range(num_samples):
+            name = faker.currency_name()
+            assert name in self.currency_names