Skip to content

Universal SEO skill for Claude Code. 26 sub-skills + 19 sub-agents covering technical SEO, E-E-A-T, schema, GEO/AEO, agent readiness (Lighthouse Agentic Browsing, WebMCP, llms.txt), backlinks, local SEO, e-commerce, international SEO, Google APIs, and PDF/Excel reporting. 9 optional extensions for live SEO data.

fix(normalize): map currency symbols to ISO codes, not just $

Rudy Celeklia9ad3522c156
diff --git a/scripts/dataforseo_normalize.py b/scripts/dataforseo_normalize.py
index 7c5b485..ecb23a4 100755
--- a/scripts/dataforseo_normalize.py
+++ b/scripts/dataforseo_normalize.py
@@ -207,8 +207,9 @@ def _normalize_currency(raw: Any) -> str:
if not raw:
return "USD"
text = str(raw).upper().strip()
- # Handle common symbols
- symbol_map = {"$": "USD", "EUR": "EUR", "GBP": "GBP", "JPY": "JPY"}
+ # Map common currency symbols to their ISO 4217 code. ISO codes already in
+ # the text pass through via the fallback below, so only symbols need listing.
+ symbol_map = {"$": "USD", "€": "EUR", "£": "GBP", "¥": "JPY"}
return symbol_map.get(text, text[:3] if len(text) >= 3 else "USD")
diff --git a/tests/test_dataforseo_normalize_currency.py b/tests/test_dataforseo_normalize_currency.py
new file mode 100644
index 0000000..3efced6
--- /dev/null
+++ b/tests/test_dataforseo_normalize_currency.py
@@ -0,0 +1,47 @@
+"""
+Tests for scripts/dataforseo_normalize.py: _normalize_currency symbol mapping.
+
+_normalize_currency documents itself as "Normalize currency to ISO 4217 code"
+and comments "Handle common symbols". It mapped the dollar sign "$" -> "USD",
+but the other symbol_map entries were ISO codes mapping to themselves
+("EUR" -> "EUR"), which are no-ops already covered by the fallback. The common
+currency symbols the comment promises to handle -- "EUR" sign, "GBP" sign,
+"JPY/CNY" sign -- fell through to the `text[:3] if len >= 3 else "USD"` branch.
+Because each is a single character, len < 3, so they silently became "USD":
+a Euro- or Pound-priced product was reported in US dollars.
+"""
+
+from __future__ import annotations
+
+import os
+import sys
+
+_SCRIPTS = os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))), "scripts")
+if _SCRIPTS not in sys.path:
+ sys.path.insert(0, _SCRIPTS)
+
+import dataforseo_normalize # noqa: E402
+
+
+def test_dollar_symbol_maps_to_usd():
+ # Baseline behaviour that already worked, kept as a guard.
+ assert dataforseo_normalize._normalize_currency("$") == "USD"
+
+
+def test_euro_symbol_maps_to_eur():
+ assert dataforseo_normalize._normalize_currency("€") == "EUR"
+
+
+def test_pound_symbol_maps_to_gbp():
+ assert dataforseo_normalize._normalize_currency("£") == "GBP"
+
+
+def test_iso_codes_pass_through_unchanged():
+ assert dataforseo_normalize._normalize_currency("EUR") == "EUR"
+ assert dataforseo_normalize._normalize_currency("gbp") == "GBP"
+ assert dataforseo_normalize._normalize_currency("usd") == "USD"
+
+
+def test_empty_defaults_to_usd():
+ assert dataforseo_normalize._normalize_currency("") == "USD"
+ assert dataforseo_normalize._normalize_currency(None) == "USD"