Пример #1
0
def test_coerce_xtrigger():
    """Test coerce_xtrigger."""
    validator = VDR()
    # The good
    for value, result in [('foo(x="bar")', 'foo(x=bar)'),
                          ('foo(x, y, z="zebra")', 'foo(x, y, z=zebra)')]:
        assert (validator.coerce_xtrigger(
            value, ['whatever']).get_signature() == result)
    # The bad
    for value in ['', 'foo(', 'foo)', 'foo,bar']:
        with pytest.raises(IllegalValueError):
            validator.coerce_xtrigger(value, ['whatever'])
Пример #2
0
 def test_coerce_xtrigger(self):
     """Test coerce_xtrigger."""
     validator = VDR()
     # The good
     for value, result in [('foo(x="bar")', 'foo(x=bar)'),
                           ('foo(x, y, z="zebra")', 'foo(x, y, z=zebra)')]:
         self.assertEqual(
             validator.coerce_xtrigger(value, ['whatever']).get_signature(),
             result)
     # The bad
     for value in ['', 'foo(', 'foo)', 'foo,bar']:
         self.assertRaises(IllegalValueError, validator.coerce_xtrigger,
                           value, ['whatever'])
Пример #3
0
 def test_coerce_xtrigger(self):
     """Test coerce_xtrigger."""
     validator = VDR()
     # The good
     for value, result in [
             ('foo(x="bar")', 'foo(x=bar)'),
             ('foo(x, y, z="zebra")', 'foo(x, y, z=zebra)')]:
         self.assertEqual(
             validator.coerce_xtrigger(value, ['whatever']).get_signature(),
             result)
     # The bad
     for value in [
             '', 'foo(', 'foo)', 'foo,bar']:
         self.assertRaises(
             IllegalValueError,
             validator.coerce_xtrigger, value, ['whatever'])