def setUp(self): self.validators = [Cusip()] self.validate_ids = ['30303M102'] self.invalid_ids = ['30303M101']
def test_is_valid(input, expected): assert Cusip().is_valid(input) == expected
def test_cusip_country_code_error(): with pytest.raises(CountryCodeError): Cusip().validate('I0303M109')
def setUp(self): self.validators = [Sedol(), Cusip(), Isin()]
def test_char_cusip(input): assert Cusip().validate(input) == input
def test_numeric_cusip(input): assert Cusip().validate(input) == input
def setUp(self): self.validators = [Sedol(), Cusip(), Isin()] def test_none_input(self): # test None input for val in self.validators: with self.subTest(val=val): self.assertRaises(NullError, val.validate, None) def test_empty_string_input(self): for val in self.validators: with self.subTest(val=val): self.assertRaises(NullError, val.validate, "") @pytest.mark.parametrize('obj', [(Sedol()), (Isin()), (Cusip())]) def test_empty_string(obj): with pytest.raises(NullError): obj.validate("") with pytest.raises(NullError): obj.validate(None) class TestValid(TestCase): def setUp(self): self.validators = [Cusip()] self.validate_ids = ['30303M102'] self.invalid_ids = ['30303M101'] def test_valid(self):
def setUp(self): self.obj = Cusip()