示例#1
0
def build_details(summaries: dict = None,
                  params: dict = None,
                  links: dict = None) -> dict:
    validate.definitions(summaries) if summaries else {}
    validate.declarations(params) if params else {}
    validate.decorations(links) if links else {}

    dictionaries = merge_dictionaries([
        build_params(params or {}),
        build_links(links or {}),
        build_summaries(summaries or {})
    ],
                                      allow_override=False)
    return polyfill_methods(dictionaries)
示例#2
0
 def test_full(self):
     decorations({
         "class": {
             "snippets": ["groupable", "match"]
         },
         "methods": {
             "match": {
                 "see": ["match_all"],
                 "link": ["http://google.com"],
                 "manual": {
                     "a":
                     "https://www.php.net/manual/en/function.preg-match.php",
                     "b": "https://t-regx.com/docs/match-first"
                 },
                 "throws": ['RuntimeException']
             },
             "match_all": {
                 "see": ["match"],
                 "link": ["https://faceboob.com"],
                 "manual": {
                     "a":
                     "https://www.php.net/manual/en/function.preg-match-all.php",
                     "b": "https://t-regx.com/docs/match"
                 },
                 "throws": ["Exception"]
             },
         },
         "groups": {
             "see": [["match", "match_all"]],
             "throws": [{
                 "methods": ["match", "match_all"],
                 "exceptions":
                 ["MalformedPatternException", "RuntimeSafeRegexException"]
             }]
         },
         "*": {
             "see": ["pattern()", "Pattern::of()"],
             "link": [
                 "https://t-regx.com",
                 "https://www.regular-expressions.info/unicode.html"
             ],
             "throws": ['SafeRegexException']
         }
     })
示例#3
0
 def test_method_raise_throws_half_exceptions(self):
     self.assertRaises(
         SchemaError, lambda: decorations(
             {"methods": {
                 "match": {
                     "throws": [{
                         "exceptions": []
                     }]
                 }
             }}))
示例#4
0
    def test_group_see_raise_on_empty_group(self):
        # given
        invalid_groups = {
            'empty': [[]],
            'single': [['A']],
        }

        # when
        for name, invalid in invalid_groups.items():
            with self.subTest(name):
                self.assertRaises(
                    SchemaError,
                    lambda: decorations({"groups": {
                        "see": invalid
                    }}))
示例#5
0
 def test_empty_group_see(self):
     decorations({"groups": {"see": []}})
示例#6
0
 def test_method_throws(self):
     decorations({"methods": {"match": {"throws": []}}})
示例#7
0
 def test_empty_class(self):
     decorations({"class": {}})
示例#8
0
 def test_method_link(self):
     decorations({"methods": {"match": {"link": []}}})
示例#9
0
 def test_method_manual(self):
     decorations({"methods": {"match": {"manual": {}}}})
示例#10
0
 def test_empty_asterisk_throws(self):
     decorations({"*": {"see": []}})
示例#11
0
 def test_method_see(self):
     decorations({"methods": {"match": {"see": []}}})
示例#12
0
 def test_empty_group_throws(self):
     decorations({"groups": {"throws": []}})
示例#13
0
 def test_empty_asterisk_link(self):
     decorations({"*": {"link": []}})
示例#14
0
 def test_empty_method(self):
     decorations({"methods": {"match": {}}})
示例#15
0
 def test_empty(self):
     decorations({})
示例#16
0
 def test_empty_class_snippets(self):
     decorations({"class": {"snippets": []}})
示例#17
0
 def test_empty_first_level(self):
     decorations({"methods": {}, "groups": {}, "*": {}})
示例#18
0
 def test_empty_asterisk(self):
     decorations({"*": {}})
示例#19
0
 def test_empty_groups(self):
     decorations({"groups": {}})
示例#20
0
 def test_empty_methods(self):
     decorations({"methods": {}})