Skip to content

Commit 2e43dff

Browse files
committed
Extract states into a constant
1 parent 74b8b44 commit 2e43dff

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

bcb/utils.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88
"SE": ["ES", "MG", "RJ", "SP"],
99
"S": ["PR", "RS", "SC"]
1010
}
11+
BRAZILIAN_STATES = []
12+
for state in BRAZILIAN_REGIONS.values():
13+
BRAZILIAN_STATES.extend(state)
1114

1215

1316
class Date:

tests/sgs/test_regional_economy.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import pandas as pd
22
import pytest
33
from bcb.sgs.regional_economy import get_non_performing_loans, get_non_performing_loans_codes
4-
from bcb.utils import BRAZILIAN_REGIONS
4+
from bcb.utils import BRAZILIAN_REGIONS, BRAZILIAN_STATES
55
from bcb.sgs import regional_economy
66

77

@@ -48,15 +48,12 @@ def non_performing_constants(self):
4848
return constants
4949

5050
def test_if_all_regions_and_states_are_there(self, non_performing_constants):
51-
states = []
52-
for state in BRAZILIAN_REGIONS.values():
53-
states.extend(state)
5451
for item_str in non_performing_constants:
5552
item = getattr(regional_economy, item_str)
5653
if "REGION" in str(item):
5754
assert (list(item.values()) == list(BRAZILIAN_REGIONS.keys())), item_str
5855
elif "STATE" in str(item):
59-
assert (list(item.values()) == states), item_str
56+
assert (list(item.values()) == BRAZILIAN_STATES), item_str
6057

6158
def test_check_if_codes_are_unique(self, non_performing_constants):
6259
for item_str in non_performing_constants:

0 commit comments

Comments
 (0)