@@ -15,7 +15,7 @@ def test_readme_index_usage_quick():
1515 validate ('surface' , surf , instance_of = int , min_value = 0 )
1616 e = exc_info .value
1717 assert str (e ) == "Error validating [surface=-1]. " \
18- "TooSmall: x >= 0 does not hold for x=-1. Wrong value: [-1] ."
18+ "TooSmall: x >= 0 does not hold for x=-1. Wrong value: -1 ."
1919
2020
2121def test_readme_usage_validator ():
@@ -56,7 +56,7 @@ def test_readme_usage_validator():
5656 v .alid = surf > 0
5757 e = exc_info .value
5858 assert str (e ) == "Error validating [surface=1j]. " \
59- "HasWrongType: Value should be an instance of %s. Wrong value: [1j] ." % repr (int )
59+ "HasWrongType: Value should be an instance of %s. Wrong value: 1j ." % repr (int )
6060
6161 from valid8 import assert_instance_of
6262 with pytest .raises (ValidationError ) as exc_info :
@@ -66,7 +66,7 @@ def test_readme_usage_validator():
6666 e = exc_info .value
6767 assert str (e ) == "Error validating [surface=1j]. " \
6868 "Validation function [assert_instance_of(surf, int) ; v.alid = surf > 0] raised " \
69- "HasWrongType: Value should be an instance of %s. Wrong value: [1j] ." % repr (int )
69+ "HasWrongType: Value should be an instance of %s. Wrong value: 1j ." % repr (int )
7070
7171
7272def test_readme_usage_customization ():
@@ -79,7 +79,7 @@ def test_readme_usage_customization():
7979 # help_msg="Surface should be a positive integer")
8080 # e = exc_info.value
8181 # assert str(e) == "Surface should be a positive integer. Error validating [surface=-1]. " \
82- # "TooSmall: x >= 0 does not hold for x=-1. Wrong value: [-1] ."
82+ # "TooSmall: x >= 0 does not hold for x=-1. Wrong value: -1 ."
8383
8484 # (A) custom error message (exception is still a ValidationError)
8585 with pytest .raises (ValidationError ) as exc_info :
@@ -99,7 +99,7 @@ class InvalidSurface(ValidationError):
9999 assert isinstance (e , InvalidSurface )
100100 assert str (e ) == "Surface should be a positive integer. " \
101101 "Error validating [surface=-1]. " \
102- "TooSmall: x >= 0 does not hold for x=-1. Wrong value: [-1] ."
102+ "TooSmall: x >= 0 does not hold for x=-1. Wrong value: -1 ."
103103
104104 # (C) custom error types with templating
105105 class InvalidSurface (ValidationError ):
@@ -112,13 +112,13 @@ class InvalidSurface(ValidationError):
112112 assert isinstance (e , InvalidSurface )
113113 assert type (e ).__name__ == "InvalidSurface[ValueError]"
114114 assert str (e ) == "Surface should be > 0, found -1. Error validating [surface=-1]. " \
115- "TooSmall: x >= 0 does not hold for x=-1. Wrong value: [-1] ."
115+ "TooSmall: x >= 0 does not hold for x=-1. Wrong value: -1 ."
116116
117117 # (D) ValueError/TypeError
118118 with pytest .raises (ValidationError ) as exc_info :
119119 validate ('surface' , - 1 , instance_of = int , min_value = 0 )
120120 e = exc_info .value
121- assert str (e ) == "Error validating [surface=-1]. TooSmall: x >= 0 does not hold for x=-1. Wrong value: [-1] ."
121+ assert str (e ) == "Error validating [surface=-1]. TooSmall: x >= 0 does not hold for x=-1. Wrong value: -1 ."
122122 assert repr (e .__class__ ) == "<class 'valid8.entry_points.ValidationError[ValueError]'>"
123123
124124 with pytest .raises (ValidationError ) as exc_info :
@@ -142,7 +142,7 @@ def test_readme_index_usage_basic():
142142 e = exc_info .value
143143 assert str (e ) == 'Error validating [surface=-1]. ' \
144144 'Validation function [is_multiple_of_100] raised ' \
145- 'IsNotMultipleOf: Value should be a multiple of 100. Wrong value: [-1] .'
145+ 'IsNotMultipleOf: Value should be a multiple of 100. Wrong value: -1 .'
146146
147147 # (2) native mini_lambda support to define validation functions
148148 from mini_lambda import x
@@ -281,7 +281,7 @@ def test_readme_index_usage_customization():
281281 assert_valid ('surface' , None , x > 0 , none_policy = NonePolicy .FAIL )
282282 e = exc_info .value
283283 assert str (e ) == 'Error validating [surface=None]. Validation function [reject_none(x > 0)] raised ' \
284- 'ValueIsNone: The value must be non-None. Wrong value: [ None] .'
284+ 'ValueIsNone: The value must be non-None. Wrong value: None.'
285285
286286 # *** (4) TEST: custom Failure (not ValidationError) message. Does it have any interest ? ***
287287 with pytest .raises (ValidationError ) as exc_info :
@@ -291,7 +291,7 @@ def test_readme_index_usage_customization():
291291 'Validation function [is_multiple_of_100] raised ' \
292292 'WrappingFailure: Surface should be a multiple of 100. ' \
293293 'Function [is_multiple_of_100] raised ' \
294- '[IsNotMultipleOf: Value should be a multiple of 100. Wrong value: [-1] ].'
294+ '[IsNotMultipleOf: Value should be a multiple of 100. Wrong value: -1 ].'
295295
296296 # (4) custom error message (exception is still a ValidationError)
297297 with pytest .raises (ValidationError ) as exc_info :
@@ -311,7 +311,7 @@ class InvalidSurface(ValidationError):
311311 assert str (e ) == 'Surface should be a positive number. ' \
312312 'Error validating [surface=-1]. ' \
313313 'Validation function [is_multiple_of_100] raised ' \
314- 'IsNotMultipleOf: Value should be a multiple of 100. Wrong value: [-1] .'
314+ 'IsNotMultipleOf: Value should be a multiple of 100. Wrong value: -1 .'
315315
316316 # (6) custom error types with templating
317317 class InvalidSurface (ValidationError ):
@@ -341,7 +341,7 @@ def test_readme_index_usage_composition():
341341 "Validation function [and((x >= 0) & (x < 10000), is_multiple_of_100)] raised " \
342342 "AtLeastOneFailed: At least one validation function failed validation for value [-1]. " \
343343 "Successes: [] / Failures: {'(x >= 0) & (x < 10000)': 'False', " \
344- "'is_multiple_of_100': 'IsNotMultipleOf: Value should be a multiple of 100. Wrong value: [-1] '}."
344+ "'is_multiple_of_100': 'IsNotMultipleOf: Value should be a multiple of 100. Wrong value: -1 '}."
345345
346346 # (8) ... with a global custom error type. Oh by the way this supports templating
347347 class InvalidSurface (ValidationError ):
@@ -358,7 +358,7 @@ class InvalidSurface(ValidationError):
358358 "AtLeastOneFailed: At least one validation function failed validation for value [-1]. " \
359359 "Successes: [] / Failures: {" \
360360 "'(x >= 0) & (x < 10000)': 'False', " \
361- "'is_multiple_of_100': 'IsNotMultipleOf: Value should be a multiple of 100. Wrong value: [-1] '}."
361+ "'is_multiple_of_100': 'IsNotMultipleOf: Value should be a multiple of 100. Wrong value: -1 '}."
362362
363363 # (9) ... and possible user-friendly intermediate failure messages
364364 with pytest .raises (ValidationError ) as exc_info :
@@ -374,7 +374,7 @@ class InvalidSurface(ValidationError):
374374 "Function [(x >= 0) & (x < 10000)] returned [False] for value [-1].', " \
375375 "'is_multiple_of_100': 'WrappingFailure: Surface should be a multiple of 100. " \
376376 "Function [is_multiple_of_100] raised [IsNotMultipleOf: Value should be a multiple of 100. " \
377- "Wrong value: [-1] ].'}."
377+ "Wrong value: -1 ].'}."
378378
379379 # *********** other even more complex tests ***********
380380
@@ -396,4 +396,4 @@ class InvalidSurface(ValidationError):
396396 "Function [(x >= 0) & (x < 10000)] returned [False] for value [-1].', " \
397397 "'is_multiple_of_100': 'WrappingFailure: Surface should be a multiple of 100, found -1. " \
398398 "Function [is_multiple_of_100] raised [IsNotMultipleOf: Value should be a multiple of 100. " \
399- "Wrong value: [-1] ].'}."
399+ "Wrong value: -1 ].'}."
0 commit comments