Esempio n. 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)
Esempio n. 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']
         }
     })
Esempio n. 3
0
 def test_method_raise_throws_half_exceptions(self):
     self.assertRaises(
         SchemaError, lambda: decorations(
             {"methods": {
                 "match": {
                     "throws": [{
                         "exceptions": []
                     }]
                 }
             }}))
Esempio n. 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
                    }}))
Esempio n. 5
0
 def test_empty_group_see(self):
     decorations({"groups": {"see": []}})
Esempio n. 6
0
 def test_method_throws(self):
     decorations({"methods": {"match": {"throws": []}}})
Esempio n. 7
0
 def test_empty_class(self):
     decorations({"class": {}})
Esempio n. 8
0
 def test_method_link(self):
     decorations({"methods": {"match": {"link": []}}})
Esempio n. 9
0
 def test_method_manual(self):
     decorations({"methods": {"match": {"manual": {}}}})
Esempio n. 10
0
 def test_empty_asterisk_throws(self):
     decorations({"*": {"see": []}})
Esempio n. 11
0
 def test_method_see(self):
     decorations({"methods": {"match": {"see": []}}})
Esempio n. 12
0
 def test_empty_group_throws(self):
     decorations({"groups": {"throws": []}})
Esempio n. 13
0
 def test_empty_asterisk_link(self):
     decorations({"*": {"link": []}})
Esempio n. 14
0
 def test_empty_method(self):
     decorations({"methods": {"match": {}}})
Esempio n. 15
0
 def test_empty(self):
     decorations({})
Esempio n. 16
0
 def test_empty_class_snippets(self):
     decorations({"class": {"snippets": []}})
Esempio n. 17
0
 def test_empty_first_level(self):
     decorations({"methods": {}, "groups": {}, "*": {}})
Esempio n. 18
0
 def test_empty_asterisk(self):
     decorations({"*": {}})
Esempio n. 19
0
 def test_empty_groups(self):
     decorations({"groups": {}})
Esempio n. 20
0
 def test_empty_methods(self):
     decorations({"methods": {}})