def val_field(self, fname, finfo, aname):
        """Pass."""
        assert isinstance(finfo, dict)

        # common
        name = finfo.pop("name")
        type = finfo.pop("type")
        prefix = finfo.pop("adapter_prefix")
        title = finfo.pop("title")

        assert isinstance(name, tools.STR) and name
        assert isinstance(title, tools.STR) and title
        assert isinstance(prefix, tools.STR) and prefix
        assert isinstance(type, tools.STR) and type

        # uncommon
        items = finfo.pop("items", {})
        sort = finfo.pop("sort", False)
        unique = finfo.pop("unique", False)
        branched = finfo.pop("branched", False)
        enums = finfo.pop("enum", [])
        description = finfo.pop("description", "")
        dynamic = finfo.pop("dynamic", False)
        format = finfo.pop("format", "")

        assert isinstance(items, dict)
        assert isinstance(sort, bool)
        assert isinstance(unique, bool)
        assert isinstance(branched, bool)
        assert isinstance(enums, tools.LIST)
        assert isinstance(description, tools.STR)
        assert isinstance(dynamic, bool)
        assert isinstance(format, tools.STR)

        assert not finfo, list(finfo)

        assert type in FIELD_TYPES, type

        if name not in ["labels", "adapters", "internal_axon_id"]:
            if aname == "generic":
                assert name.startswith("specific_data")
            else:
                assert name.startswith(prefix)

        for enum in enums:
            assert isinstance(enum, tools.STR) or tools.is_int(enum)

        if format:
            assert format in FIELD_FORMATS, format

        val_items(aname=aname, items=items)
def val_items(aname, items):
    """Pass."""
    assert isinstance(items, dict)

    if items:
        # common
        type = items.pop("type")

        assert isinstance(type, tools.STR) and type
        assert type in FIELD_TYPES, type

        # uncommon
        enums = items.pop("enum", [])
        format = items.pop("format", "")
        iitems = items.pop("items", [])
        name = items.pop("name", "")
        title = items.pop("title", "")
        description = items.pop("description", "")
        branched = items.pop("branched", False)
        dynamic = items.pop("dynamic", False)

        if format:
            assert format in SCHEMA_FIELD_FORMATS, format

        assert isinstance(enums, tools.LIST)
        assert isinstance(iitems, tools.LIST) or isinstance(iitems, dict)
        assert isinstance(format, tools.STR)
        assert isinstance(name, tools.STR)
        assert isinstance(title, tools.STR)
        assert isinstance(description, tools.STR)
        assert isinstance(branched, bool)
        assert isinstance(dynamic, bool)

        assert not items, list(items)

        for enum in enums:
            assert isinstance(enum, tools.STR) or tools.is_int(enum)

        if isinstance(iitems, dict):
            val_items(aname=aname, items=iitems)
        else:
            for iitem in iitems:
                val_items(aname=aname, items=iitem)
    def val_fields(self, aname, afields):
        """Pass."""
        assert isinstance(afields, tools.LIST)

        for field in afields:
            # common
            name = field.pop("name")
            title = field.pop("title")
            type = field.pop("type")

            assert isinstance(name, tools.STR) and name
            assert isinstance(title, tools.STR) and title
            assert isinstance(type, tools.STR) and type

            assert type in ["array", "string", "integer", "number", "bool"]

            # uncommon
            branched = field.pop("branched", False)
            description = field.pop("description", "")
            enums = field.pop("enum", [])
            format = field.pop("format", "")
            items = field.pop("items", {})
            sort = field.pop("sort", False)
            unique = field.pop("unique", False)
            dynamic = field.pop("dynamic", False)

            assert isinstance(branched, bool)
            assert isinstance(description, tools.STR)
            assert isinstance(enums, tools.LIST)
            assert isinstance(format, tools.STR)
            assert isinstance(items, dict)
            assert isinstance(sort, bool)
            assert isinstance(unique, bool)
            assert isinstance(dynamic, bool)

            assert not field, list(field)

            for enum in enums:
                assert isinstance(enum, tools.STR) or tools.is_int(enum)

            val_items(aname=aname, items=items)
 def test_int_digit_true(self, ok, bad):
     """Simple test."""
     assert is_int(obj=ok, digit=True)
     assert not is_int(obj=bad, digit=True)
 def test_int_digit_false(self, ok, bad):
     """Simple test."""
     assert is_int(obj=ok, digit=False)
     assert not is_int(obj=bad, digit=False)