コード例 #1
0
 def test_fails_to_format_classmethod_name(self):
     e_expected = AglyphError(
         "%r does not have an importable dotted name" %
             dummy.ModuleClass.classmethod_factory)
     assertRaisesWithMessage(
         self, e_expected, format_dotted_name,
         dummy.ModuleClass.classmethod_factory)
コード例 #2
0
 def test_register_fails_on_nonimportable_object(self):
     builder = self._builder_type(
         _MockContext(), dummy.ModuleClass.NestedClass)
     e_expected = AglyphError(
         "%r does not have an importable dotted name" %
             dummy.ModuleClass.NestedClass)
     assertRaisesWithMessage(self, e_expected, builder.register)
コード例 #3
0
ファイル: test_Template.py プロジェクト: mzipay/Aglyph
 def test_unique_id_cannot_be_empty(self):
     # use __class__ so test is reusable for Template & Component
     e_expected = ValueError(
         "%s unique ID must not be None or empty" %
             name_of(self._support.__class__))
     assertRaisesWithMessage(
         self, e_expected, self._support.__class__, "")
コード例 #4
0
 def test_fails_to_format_property_name(self):
     # property doesn't have __module__, __qualname__, or __name__
     e_expected = AglyphError(
         "%r does not have an importable dotted name" %
             dummy.ModuleClass.prop)
     assertRaisesWithMessage(
         self, e_expected, format_dotted_name, dummy.ModuleClass.prop)
コード例 #5
0
ファイル: test_Reference.py プロジェクト: mzipay/Aglyph
 def test_staticmethod(self):
     e_expected = AglyphError(
         "%r does not have an importable dotted name" %
             dummy.ModuleClass.staticmethod_factory)
     assertRaisesWithMessage(
         self, e_expected, Reference,
         dummy.ModuleClass.staticmethod_factory)
コード例 #6
0
 def test_rejects_unrecognized_strategy(self):
     e_expected = ValueError(
         "unrecognized assembly strategy 'unrecognized'")
     assertRaisesWithMessage(self,
                             e_expected,
                             Component,
                             "test",
                             strategy="unrecognized")
コード例 #7
0
 def test_factory_name_and_member_name_are_mutually_exclusive(self):
     e_expected = AglyphError(
         "only one of factory_name or member_name may be specified")
     assertRaisesWithMessage(self,
                             e_expected,
                             Component,
                             "test",
                             factory_name="factory",
                             member_name="member")
コード例 #8
0
ファイル: test_Context.py プロジェクト: subokita/Aglyph
 def test_context_id_cannot_be_empty(self):
     e_expected = AglyphError(
         "%s ID must not be None or empty" %
             name_of(self._context.__class__))
     assertRaisesWithMessage(self, e_expected, self._context.__class__, "")
コード例 #9
0
 def test_template_id_is_required(self):
     stream = bytebuf(self._uresource.encode("utf-8"))
     e_expected = ValueError("Template unique ID must not be None or empty")
     assertRaisesWithMessage(self, e_expected, XMLContext, stream)
コード例 #10
0
 def test_attribute_rejects_multiple_children(self):
     stream = bytebuf(self._uresource.encode("utf-8"))
     e_expected = AglyphError(
         "<attribute> must contain exactly one child element; "
         "found attribute/str, attribute/int")
     assertRaisesWithMessage(self, e_expected, XMLContext, stream)
コード例 #11
0
ファイル: test_identify.py プロジェクト: subokita/Aglyph
 def test_fails_to_identify_instance(self):
     # instance doesn't have __qualname__ or __name__
     instance = dummy.ModuleClass(None)
     e_expected = AglyphError("%r does not have an importable dotted name" %
                              instance)
     assertRaisesWithMessage(self, e_expected, _identify, instance)
コード例 #12
0
ファイル: test_Reference.py プロジェクト: mzipay/Aglyph
 def test_nonimportable_function(self):
     nested_function = dummy.outer_function()
     e_expected = AglyphError(
         "%r does not have an importable dotted name" % nested_function)
     assertRaisesWithMessage(self, e_expected, Reference, nested_function)
コード例 #13
0
 def test_fails_to_format_bound_function_name(self):
     bound_function = dummy.MODULE_MEMBER.method
     e_expected = AglyphError(
         "%r does not have an importable dotted name" % bound_function)
     assertRaisesWithMessage(
         self, e_expected, format_dotted_name, bound_function)
コード例 #14
0
ファイル: test_XMLContext.py プロジェクト: mzipay/Aglyph
 def test_attribute_name_cannot_be_empty(self):
     stream = bytebuf(self._uresource.encode("utf-8"))
     e_expected = AglyphError(
         "attribute/@name is required and cannot be empty")
     assertRaisesWithMessage(self, e_expected, XMLContext, stream)
コード例 #15
0
ファイル: test_XMLContext.py プロジェクト: mzipay/Aglyph
 def test_process_attributes_unexpected_children(self):
     stream = bytebuf(self._uresource.encode("utf-8"))
     e_expected = AglyphError("unexpected element: attributes/unexpected")
     assertRaisesWithMessage(self, e_expected, XMLContext, stream)
コード例 #16
0
ファイル: test_XMLContext.py プロジェクト: mzipay/Aglyph
 def test_dict_item_value_unexpected_children(self):
     stream = bytebuf(self._uresource.encode("utf-8"))
     e_expected = AglyphError("unexpected element: value/unexpected")
     assertRaisesWithMessage(self, e_expected, XMLContext, stream)
コード例 #17
0
ファイル: test_XMLContext.py プロジェクト: mzipay/Aglyph
 def test_dict_item_key_rejects_multiple_children(self):
     stream = bytebuf(self._uresource.encode("utf-8"))
     e_expected = AglyphError(
         "<key> must contain exactly one child element; "
         "found key/str, key/int")
     assertRaisesWithMessage(self, e_expected, XMLContext, stream)
コード例 #18
0
ファイル: test_XMLContext.py プロジェクト: mzipay/Aglyph
 def test_parse_dict_item_unexpected_children(self):
     stream = bytebuf(self._uresource.encode("utf-8"))
     e_expected = AglyphError(
         "expected item/key, item/value; found item/unexpected")
     assertRaisesWithMessage(self, e_expected, XMLContext, stream)
コード例 #19
0
ファイル: test_XMLContext.py プロジェクト: mzipay/Aglyph
 def test_arg_keyword_cannot_be_empty(self):
     stream = bytebuf(self._uresource.encode("utf-8"))
     e_expected = AglyphError("arg/@keyword cannot be empty")
     assertRaisesWithMessage(self, e_expected, XMLContext, stream)
コード例 #20
0
 def test_bound_method(self):
     bound_method = dummy.ModuleClass(None).method
     e_expected = AglyphError("%r does not have an importable dotted name" %
                              bound_method)
     assertRaisesWithMessage(self, e_expected, Reference, bound_method)
コード例 #21
0
ファイル: test_Reference.py プロジェクト: mzipay/Aglyph
 def test_builtin_object(self):
     e_expected = AglyphError("79 does not have an importable dotted name")
     assertRaisesWithMessage(self, e_expected, Reference, 79)
コード例 #22
0
ファイル: test_XMLContext.py プロジェクト: mzipay/Aglyph
 def test_attribute_cannot_be_empty(self):
     stream = bytebuf(self._uresource.encode("utf-8"))
     e_expected = AglyphError(
         "<attribute> must contain exactly one child element; "
         "found no children")
     assertRaisesWithMessage(self, e_expected, XMLContext, stream)
コード例 #23
0
 def test_fails_to_format_name_for_none(self):
     # None doesn't have __module__, __qualname__, or __name__
     e_expected = AglyphError(
         "%r does not have an importable dotted name" % None)
     assertRaisesWithMessage(self, e_expected, format_dotted_name, None)
コード例 #24
0
ファイル: test_XMLContext.py プロジェクト: mzipay/Aglyph
 def test_attribute_rejects_multiple_children(self):
     stream = bytebuf(self._uresource.encode("utf-8"))
     e_expected = AglyphError(
         "<attribute> must contain exactly one child element; "
         "found attribute/str, attribute/int")
     assertRaisesWithMessage(self, e_expected, XMLContext, stream)
コード例 #25
0
ファイル: test_identify.py プロジェクト: subokita/Aglyph
 def test_fails_to_identify_classmethod(self):
     e_expected = AglyphError("%r does not have an importable dotted name" %
                              dummy.ModuleClass.classmethod_factory)
     assertRaisesWithMessage(self, e_expected, _identify,
                             dummy.ModuleClass.classmethod_factory)
コード例 #26
0
ファイル: test_XMLContext.py プロジェクト: mzipay/Aglyph
 def test_context_id_cannot_be_empty(self):
     stream = bytebuf(self._uresource.encode("utf-8"))
     e_expected = AglyphError("XMLContext ID must not be None or empty")
     assertRaisesWithMessage(self, e_expected, XMLContext, stream)
コード例 #27
0
ファイル: test_Reference.py プロジェクト: mzipay/Aglyph
 def test_bound_method(self):
     bound_method = dummy.ModuleClass(None).method
     e_expected = AglyphError(
         "%r does not have an importable dotted name" % bound_method)
     assertRaisesWithMessage(self, e_expected, Reference, bound_method)
コード例 #28
0
ファイル: test_XMLContext.py プロジェクト: mzipay/Aglyph
 def test_template_id_is_required(self):
     stream = bytebuf(self._uresource.encode("utf-8"))
     e_expected = ValueError(
         "Template unique ID must not be None or empty")
     assertRaisesWithMessage(self, e_expected, XMLContext, stream)
コード例 #29
0
 def test_context_id_cannot_be_empty(self):
     stream = bytebuf(self._uresource.encode("utf-8"))
     e_expected = AglyphError("XMLContext ID must not be None or empty")
     assertRaisesWithMessage(self, e_expected, XMLContext, stream)
コード例 #30
0
ファイル: test_Assembler.py プロジェクト: subokita/Aglyph
 def test_detects_circular_dependency(self):
     e = AglyphError("circular dependency detected: "
                     "circular-2 > circular-3 > circular-1 > circular-2")
     assertRaisesWithMessage(self, e, self._assembler.assemble,
                             "circular-2")
コード例 #31
0
 def test_fails_to_format_nested_class_name(self):
     e_expected = AglyphError("%r does not have an importable dotted name" %
                              dummy.ModuleClass.NestedClass)
     assertRaisesWithMessage(self, e_expected, format_dotted_name,
                             dummy.ModuleClass.NestedClass)
コード例 #32
0
 def test_fails_to_format_staticmethod_name(self):
     e_expected = AglyphError("%r does not have an importable dotted name" %
                              dummy.ModuleClass.staticmethod_factory)
     assertRaisesWithMessage(self, e_expected, format_dotted_name,
                             dummy.ModuleClass.staticmethod_factory)
コード例 #33
0
 def test_unique_id_cannot_be_empty(self):
     # use __class__ so test is reusable for Template & Component
     e_expected = ValueError("%s unique ID must not be None or empty" %
                             name_of(self._support.__class__))
     assertRaisesWithMessage(self, e_expected, self._support.__class__, "")
コード例 #34
0
 def test_nonimportable_function(self):
     nested_function = dummy.outer_function()
     e_expected = AglyphError("%r does not have an importable dotted name" %
                              nested_function)
     assertRaisesWithMessage(self, e_expected, Reference, nested_function)
コード例 #35
0
ファイル: test_Assembler.py プロジェクト: mzipay/Aglyph
 def test_detects_circular_dependency(self):
     e = AglyphError(
         "circular dependency detected: "
         "circular-2 > circular-3 > circular-1 > circular-2")
     assertRaisesWithMessage(
         self, e, self._assembler.assemble, "circular-2")
コード例 #36
0
 def test_builtin_object(self):
     e_expected = AglyphError("79 does not have an importable dotted name")
     assertRaisesWithMessage(self, e_expected, Reference, 79)
コード例 #37
0
 def test_nonimportable_class(self):
     e_expected = AglyphError("%r does not have an importable dotted name" %
                              dummy.ModuleClass.NestedClass)
     assertRaisesWithMessage(self, e_expected, Reference,
                             dummy.ModuleClass.NestedClass)
コード例 #38
0
ファイル: test_Reference.py プロジェクト: mzipay/Aglyph
 def test_user_object(self):
     obj = dummy.ModuleClass(None)
     e_expected = AglyphError(
         "%r does not have an importable dotted name" % obj)
     assertRaisesWithMessage(self, e_expected, Reference, obj)
コード例 #39
0
 def test_user_object(self):
     obj = dummy.ModuleClass(None)
     e_expected = AglyphError("%r does not have an importable dotted name" %
                              obj)
     assertRaisesWithMessage(self, e_expected, Reference, obj)
コード例 #40
0
 def test_arg_keyword_cannot_be_empty(self):
     stream = bytebuf(self._uresource.encode("utf-8"))
     e_expected = AglyphError("arg/@keyword cannot be empty")
     assertRaisesWithMessage(self, e_expected, XMLContext, stream)
コード例 #41
0
 def test_staticmethod(self):
     e_expected = AglyphError("%r does not have an importable dotted name" %
                              dummy.ModuleClass.staticmethod_factory)
     assertRaisesWithMessage(self, e_expected, Reference,
                             dummy.ModuleClass.staticmethod_factory)
コード例 #42
0
 def test_parse_dict_item_unexpected_children(self):
     stream = bytebuf(self._uresource.encode("utf-8"))
     e_expected = AglyphError(
         "expected item/key, item/value; found item/unexpected")
     assertRaisesWithMessage(self, e_expected, XMLContext, stream)
コード例 #43
0
 def test_fails_to_format_nested_function_name(self):
     nested_function = dummy.outer_function()
     e_expected = AglyphError(
         "%r does not have an importable dotted name" % nested_function)
     assertRaisesWithMessage(
         self, e_expected, format_dotted_name, nested_function)
コード例 #44
0
ファイル: test_identify.py プロジェクト: subokita/Aglyph
 def test_fails_to_identify_property(self):
     # property doesn't have __module__, __qualname__, or __name__
     e_expected = AglyphError("%r does not have an importable dotted name" %
                              dummy.ModuleClass.prop)
     assertRaisesWithMessage(self, e_expected, _identify,
                             dummy.ModuleClass.prop)
コード例 #45
0
 def test_dict_item_key_rejects_multiple_children(self):
     stream = bytebuf(self._uresource.encode("utf-8"))
     e_expected = AglyphError(
         "<key> must contain exactly one child element; "
         "found key/str, key/int")
     assertRaisesWithMessage(self, e_expected, XMLContext, stream)
コード例 #46
0
ファイル: test_Reference.py プロジェクト: mzipay/Aglyph
 def test_nonimportable_class(self):
     e_expected = AglyphError(
         "%r does not have an importable dotted name" %
             dummy.ModuleClass.NestedClass)
     assertRaisesWithMessage(
         self, e_expected, Reference, dummy.ModuleClass.NestedClass)
コード例 #47
0
 def test_fails_to_format_instance_name(self):
     # instance doesn't have __qualname__ or __name__
     instance = dummy.ModuleClass(None)
     e_expected = AglyphError(
         "%r does not have an importable dotted name" % instance)
     assertRaisesWithMessage(self, e_expected, format_dotted_name, instance)
コード例 #48
0
 def test_dict_item_value_unexpected_children(self):
     stream = bytebuf(self._uresource.encode("utf-8"))
     e_expected = AglyphError("unexpected element: value/unexpected")
     assertRaisesWithMessage(self, e_expected, XMLContext, stream)
コード例 #49
0
ファイル: test_identify.py プロジェクト: subokita/Aglyph
 def test_fails_to_identify_none(self):
     # None doesn't have __module__, __qualname__, or __name__
     e_expected = AglyphError("%r does not have an importable dotted name" %
                              None)
     assertRaisesWithMessage(self, e_expected, _identify, None)
コード例 #50
0
 def test_process_attributes_unexpected_children(self):
     stream = bytebuf(self._uresource.encode("utf-8"))
     e_expected = AglyphError("unexpected element: attributes/unexpected")
     assertRaisesWithMessage(self, e_expected, XMLContext, stream)
コード例 #51
0
ファイル: test_identify.py プロジェクト: subokita/Aglyph
 def test_fails_to_identify_nested_function(self):
     nested_function = dummy.outer_function()
     e_expected = AglyphError("%r does not have an importable dotted name" %
                              nested_function)
     assertRaisesWithMessage(self, e_expected, _identify, nested_function)
コード例 #52
0
 def test_attribute_name_cannot_be_empty(self):
     stream = bytebuf(self._uresource.encode("utf-8"))
     e_expected = AglyphError(
         "attribute/@name is required and cannot be empty")
     assertRaisesWithMessage(self, e_expected, XMLContext, stream)
コード例 #53
0
ファイル: test_identify.py プロジェクト: subokita/Aglyph
 def test_fails_to_identify_bound_function(self):
     bound_function = dummy.MODULE_MEMBER.method
     e_expected = AglyphError("%r does not have an importable dotted name" %
                              bound_function)
     assertRaisesWithMessage(self, e_expected, _identify, bound_function)
コード例 #54
0
 def test_attribute_cannot_be_empty(self):
     stream = bytebuf(self._uresource.encode("utf-8"))
     e_expected = AglyphError(
         "<attribute> must contain exactly one child element; "
         "found no children")
     assertRaisesWithMessage(self, e_expected, XMLContext, stream)