def test_postalcode_in_state(self, faker, num_samples):
    for _ in range(num_samples):
        for state_abbr in EnUsAddressProvider.states_abbr:
            code = faker.postalcode_in_state(state_abbr)
            assert re.fullmatch('\\d{5}', code)
            assert (int(code) >= EnUsAddressProvider.states_postcode[state_abbr][0])
            assert (int(code) <= EnUsAddressProvider.states_postcode[state_abbr][1])
    with pytest.raises(Exception):
        faker.postalcode_in_state('XX')
def test_postalcode_in_state(self, faker, num_samples):
    for _ in range(num_samples):
        for state_abbr in EnUsAddressProvider.states_abbr:
            code = faker.postalcode_in_state(state_abbr)
            assert re.fullmatch('\\d{5}', code)
            assert (int(code) >= EnUsAddressProvider.states_postcode[state_abbr][0])
            assert (int(code) <= EnUsAddressProvider.states_postcode[state_abbr][1])
    with pytest.raises(Exception):
        faker.postalcode_in_state('XX')