@@ -83,14 +83,46 @@ def test_if_a_version_is_provided_it_is_registered(self):
83
83
)
84
84
self .addCleanup (validators .meta_schemas .pop , "something" )
85
85
self .assertEqual (Validator .__name__ , "MyVersionValidator" )
86
+ self .assertEqual (Validator .__qualname__ , "MyVersionValidator" )
87
+
88
+ def test_repr (self ):
89
+ Validator = validators .create (
90
+ meta_schema = {"$id" : "something" },
91
+ version = "my version" ,
92
+ )
93
+ self .addCleanup (validators .meta_schemas .pop , "something" )
94
+ self .assertEqual (
95
+ repr (Validator ({})),
96
+ "MyVersionValidator(schema={}, format_checker=None)" ,
97
+ )
98
+
99
+ def test_long_repr (self ):
100
+ Validator = validators .create (
101
+ meta_schema = {"$id" : "something" },
102
+ version = "my version" ,
103
+ )
104
+ self .addCleanup (validators .meta_schemas .pop , "something" )
105
+ self .assertEqual (
106
+ repr (Validator ({"a" : list (range (1000 ))})), (
107
+ "MyVersionValidator(schema={'a': [0, 1, 2, 3, 4, 5, ...]}, "
108
+ "format_checker=None)"
109
+ ),
110
+ )
111
+
112
+ def test_repr_no_version (self ):
113
+ Validator = validators .create (meta_schema = {})
114
+ self .assertEqual (
115
+ repr (Validator ({})),
116
+ "Validator(schema={}, format_checker=None)" ,
117
+ )
86
118
87
119
def test_dashes_are_stripped_from_validator_names (self ):
88
120
Validator = validators .create (
89
121
meta_schema = {"$id" : "something" },
90
122
version = "foo-bar" ,
91
123
)
92
124
self .addCleanup (validators .meta_schemas .pop , "something" )
93
- self .assertEqual (Validator .__name__ , "FooBarValidator" )
125
+ self .assertEqual (Validator .__qualname__ , "FooBarValidator" )
94
126
95
127
def test_if_a_version_is_not_provided_it_is_not_registered (self ):
96
128
original = dict (validators .meta_schemas )
0 commit comments