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