File: test_schema.py

package info (click to toggle)
python-marshmallow 3.26.1-0.4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,296 kB
  • sloc: python: 11,513; makefile: 11; sh: 8
file content (29 lines) | stat: -rw-r--r-- 748 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import json

from marshmallow import EXCLUDE, Schema
from marshmallow.fields import Integer, String


# Test that valid `Meta` class attributes pass type checking
class MySchema(Schema):
    foo = String()
    bar = Integer()

    class Meta(Schema.Meta):
        fields = ("foo", "bar")
        additional = ("baz", "qux")
        include = {
            "foo2": String(),
        }
        exclude = ("bar", "baz")
        many = True
        dateformat = "%Y-%m-%d"
        datetimeformat = "%Y-%m-%dT%H:%M:%S"
        timeformat = "%H:%M:%S"
        render_module = json
        ordered = False
        index_errors = True
        load_only = ("foo", "bar")
        dump_only = ("baz", "qux")
        unknown = EXCLUDE
        register = False