Пример #1
0
def test_annotation_schema_dump_none_datetime_as_null(
        annotation_schema: AnnotationSchema,
        deserialized_annotation: Annotation):
    deserialized_annotation.timestamp = None
    assert annotation_schema.dump(deserialized_annotation)['timestamp'] is None
Пример #2
0
def test_annotation_schema_dump_one_dict_many_false(
        annotation_schema: AnnotationSchema,
        deserialized_annotation: Annotation, serialized_annotation: dict):
    assert annotation_schema.dump(
        deserialized_annotation) == serialized_annotation
Пример #3
0
def test_annotation_schema_dump_list_no_empty_many_true(
        annotation_schema: AnnotationSchema,
        deserialized_annotation: Annotation):
    assert len(annotation_schema.dump([deserialized_annotation],
                                      many=True)) == 1
Пример #4
0
def test_annotation_schema_dump_list_of_dicts_many_true(
        annotation_schema: AnnotationSchema,
        deserialized_annotation: Annotation):
    assert type(
        annotation_schema.dump([deserialized_annotation],
                               many=True)[0]) is dict
Пример #5
0
def test_annotation_schema_dump_one_dict_many_true(
        annotation_schema: AnnotationSchema,
        deserialized_annotation: Annotation, serialized_annotation: dict):
    assert annotation_schema.dump([deserialized_annotation],
                                  many=True) == [serialized_annotation]