Пример #1
0
def test_annotation_schema_load_null_datetime_as_none(
        annotation_schema: AnnotationSchema, serialized_annotation: dict):
    serialized_annotation['timestamp'] = None
    annotation = annotation_schema.load(serialized_annotation)
    assert annotation.timestamp is None
Пример #2
0
def test_annotation_schema_load_list_of_dicts_many_true(
        annotation_schema: AnnotationSchema, serialized_annotation: dict):
    assert type(annotation_schema.load([serialized_annotation],
                                       many=True)[0]) is Annotation
Пример #3
0
def test_annotation_schema_load_one_dict_many_true(
        annotation_schema: AnnotationSchema,
        deserialized_annotation: Annotation, serialized_annotation: dict):
    assert annotation_schema.load([serialized_annotation],
                                  many=True) == [deserialized_annotation]
Пример #4
0
def test_annotation_schema_load_list_no_empty_many_true(
        annotation_schema: AnnotationSchema, serialized_annotation: dict):
    assert len(annotation_schema.load([serialized_annotation], many=True)) == 1
Пример #5
0
def test_annotation_schema_load_one_dict_many_false(
        annotation_schema: AnnotationSchema,
        deserialized_annotation: Annotation, serialized_annotation: dict):
    assert annotation_schema.load(
        serialized_annotation) == deserialized_annotation