Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_multi_validator(self):
with self.assertRaises(TypeError):
val = v_entries.AllValidator(v_entries.FloatValidator, int)
self.assertTrue(
v_entries.AllValidator(
v_entries.RegexValidator(r'.'),
v_entries.RegexValidator(r'\d'),
)._validate('1')
)
self.assertFalse(
v_entries.AllValidator(
v_entries.RegexValidator(r'[a-z]'),
v_entries.RegexValidator(r'\d'),
)._validate('1')
)
self.assertTrue(
v_entries.AnyValidator(
v_entries.RegexValidator(r'.'),
v_entries.RegexValidator(r'\d'),
)._validate('1')
)
def test_multi_validator(self):
with self.assertRaises(TypeError):
val = v_entries.AllValidator(v_entries.FloatValidator, int)
self.assertTrue(
v_entries.AllValidator(
v_entries.RegexValidator(r'.'),
v_entries.RegexValidator(r'\d'),
)._validate('1')
)
self.assertFalse(
v_entries.AllValidator(
v_entries.RegexValidator(r'[a-z]'),
v_entries.RegexValidator(r'\d'),
)._validate('1')
)
self.assertTrue(
v_entries.AnyValidator(
v_entries.RegexValidator(r'.'),
v_entries.RegexValidator(r'\d'),
)._validate('1')
)
self.assertTrue(
v_entries.AnyValidator(
v_entries.RegexValidator(r'[a-z]'),
v_entries.RegexValidator(r'\d'),
)._validate('1')
)
def test_regex_validator(self):
self.assertTrue(v_entries.RegexValidator(r'\d')._validate('1'))
self.assertTrue(v_entries.RegexValidator(r'[a-z]')._validate('a'))
self.assertFalse(v_entries.RegexValidator(r'[a-z]')._validate('1'))
self.assertFalse(v_entries.RegexValidator(r'\d')._validate('a'))
def test_regex_validator(self):
self.assertTrue(v_entries.RegexValidator(r'\d')._validate('1'))
self.assertTrue(v_entries.RegexValidator(r'[a-z]')._validate('a'))
self.assertFalse(v_entries.RegexValidator(r'[a-z]')._validate('1'))
self.assertFalse(v_entries.RegexValidator(r'\d')._validate('a'))
self.assertTrue(
v_entries.AllValidator(
v_entries.RegexValidator(r'.'),
v_entries.RegexValidator(r'\d'),
)._validate('1')
)
self.assertFalse(
v_entries.AllValidator(
v_entries.RegexValidator(r'[a-z]'),
v_entries.RegexValidator(r'\d'),
)._validate('1')
)
self.assertTrue(
v_entries.AnyValidator(
v_entries.RegexValidator(r'.'),
v_entries.RegexValidator(r'\d'),
)._validate('1')
)
self.assertTrue(
v_entries.AnyValidator(
v_entries.RegexValidator(r'[a-z]'),
v_entries.RegexValidator(r'\d'),
)._validate('1')
)
self.assertFalse(
v_entries.AllValidator(
v_entries.RegexValidator(r'[a-z]'),
v_entries.RegexValidator(r'\d'),
)._validate('1')
)
self.assertTrue(
v_entries.AnyValidator(
v_entries.RegexValidator(r'.'),
v_entries.RegexValidator(r'\d'),
)._validate('1')
)
self.assertTrue(
v_entries.AnyValidator(
v_entries.RegexValidator(r'[a-z]'),
v_entries.RegexValidator(r'\d'),
)._validate('1')
)
def test_multi_validator(self):
with self.assertRaises(TypeError):
val = v_entries.AllValidator(v_entries.FloatValidator, int)
self.assertTrue(
v_entries.AllValidator(
v_entries.RegexValidator(r'.'),
v_entries.RegexValidator(r'\d'),
)._validate('1')
)
self.assertFalse(
v_entries.AllValidator(
v_entries.RegexValidator(r'[a-z]'),
v_entries.RegexValidator(r'\d'),
)._validate('1')
)
self.assertTrue(
v_entries.AnyValidator(
v_entries.RegexValidator(r'.'),
v_entries.RegexValidator(r'\d'),
)._validate('1')
)
self.assertTrue(
v_entries.AnyValidator(
v_entries.RegexValidator(r'[a-z]'),
v_entries.RegexValidator(r'\d'),
)._validate('1')
)
v_entries.AllValidator(
v_entries.RegexValidator(r'[a-z]'),
v_entries.RegexValidator(r'\d'),
)._validate('1')
)
self.assertTrue(
v_entries.AnyValidator(
v_entries.RegexValidator(r'.'),
v_entries.RegexValidator(r'\d'),
)._validate('1')
)
self.assertTrue(
v_entries.AnyValidator(
v_entries.RegexValidator(r'[a-z]'),
v_entries.RegexValidator(r'\d'),
)._validate('1')
)