-
-
Notifications
You must be signed in to change notification settings - Fork 632
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
change TypedDatatypeInstanceConstructionError to subclass TypeError
- Loading branch information
1 parent
9ab7a30
commit 4f9ba6c
Showing
3 changed files
with
29 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# coding=utf-8 | ||
# Copyright 2018 Pants project contributors (see CONTRIBUTORS.md). | ||
# Licensed under the Apache License, Version 2.0 (see LICENSE). | ||
|
||
from __future__ import (absolute_import, division, generators, nested_scopes, print_function, | ||
unicode_literals, with_statement) | ||
|
||
from pants.option.global_options import GlobMatchErrorBehavior | ||
from pants_test.base_test import BaseTest | ||
|
||
|
||
class GlobalOptionsTest(BaseTest): | ||
|
||
def test_exception_glob_match_constructor(self): | ||
# NB: 'allow' is not a valid value for GlobMatchErrorBehavior. | ||
with self.assertRaises(TypeError) as cm: | ||
GlobMatchErrorBehavior(str('allow')) | ||
expected_msg = ( | ||
"""error: in constructor of type GlobMatchErrorBehavior: type check error: | ||
Value 'allow' for failure_behavior must be one of: [u'ignore', u'warn', u'error'].""") | ||
self.assertEqual(str(cm.exception), expected_msg) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters