Skip to content

Commit ce21921

Browse files
author
Steve Ayers
committed
Add config to module init.py
1 parent b957343 commit ce21921

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

protovalidate/__init__.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,9 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
from protovalidate import validator
15+
from protovalidate import config, validator
1616

17+
Config = config.Config
1718
Validator = validator.Validator
1819
CompilationError = validator.CompilationError
1920
ValidationError = validator.ValidationError
@@ -23,4 +24,4 @@
2324
validate = _default_validator.validate
2425
collect_violations = _default_validator.collect_violations
2526

26-
__all__ = ["CompilationError", "ValidationError", "Validator", "Violations", "collect_violations", "validate"]
27+
__all__ = ["CompilationError", "Config", "ValidationError", "Validator", "Violations", "collect_violations", "validate"]

tests/config_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
import unittest
1616

17-
from protovalidate.config import Config
17+
from protovalidate import Config
1818

1919

2020
class TestConfig(unittest.TestCase):

tests/validate_test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -257,12 +257,12 @@ def _run_compilation_error_tests(self, msg: message.Message, expected: str):
257257
# Test validate
258258
with self.assertRaises(protovalidate.CompilationError) as vce:
259259
v.validate(msg)
260-
assert str(vce.exception) == expected
260+
self.assertEqual(str(vce.exception), expected)
261261

262262
# Test collect_violations
263263
with self.assertRaises(protovalidate.CompilationError) as cvce:
264264
v.collect_violations(msg)
265-
assert str(cvce.exception) == expected
265+
self.assertEqual(str(cvce.exception), expected)
266266

267267
def _compare_violations(self, actual: list[rules.Violation], expected: list[rules.Violation]) -> None:
268268
"""Compares two lists of violations. The violations are expected to be in the expected order also."""

0 commit comments

Comments
 (0)