# Path: fastavro/schema.py
# FINGERPRINT_ALGORITHMS = _schema.FINGERPRINT_ALGORITHMS
# 
# Path: fastavro/_schema_common.py
# PRIMITIVES = {
#     "boolean",
#     "bytes",
#     "double",
#     "float",
#     "int",
#     "long",
#     "null",
#     "string",
# }


import pytest
from fastavro.schema import to_parsing_canonical_form
from fastavro._schema_common import PRIMITIVES

def test_record_field_order():
    schema = {
        "fields": [],
        "name": "test_record_field_order",
        "type": "record",
    }

    assert (
        to_parsing_canonical_form(schema)
        == '{"name":"test_record_field_order","type":"record","fields":[]}'
    )


def test_enum_field_order():
    schema = {
        "symbols": ["A", "B"],
        "name": "test_enum_field_order",
        "type": "enum",
    }

    assert (
        to_parsing_canonical_form(schema)
        == '{"name":"test_enum_field_order","type":"enum","symbols":["A","B"]}'
    )


def test_array_field_order():
    schema = {"items": "int", "type": "array"}


# Path: fastavro/schema.py
# FINGERPRINT_ALGORITHMS = _schema.FINGERPRINT_ALGORITHMS
# 
# Path: fastavro/_schema_common.py
# PRIMITIVES = {
#     "boolean",
#     "bytes",
#     "double",
#     "float",
#     "int",
#     "long",
#     "null",
#     "string",
# }


# Path: tests/test_canonical_form.py
import pytest
from fastavro.schema import to_parsing_canonical_form
from fastavro._schema_common import PRIMITIVES


def test_record_field_order():
    schema = {
        "fields": [],
        "name": "test_record_field_order",
        "type": "record",
    }

    assert (
        to_parsing_canonical_form(schema)
        == '{"name":"test_record_field_order","type":"record","fields":[]}'
    )


def test_enum_field_order():
    schema = {
        "symbols": ["A", "B"],
        "name": "test_enum_field_order",
        "type": "enum",
    }

    assert (
        to_parsing_canonical_form(schema)
        == '{"name":"test_enum_field_order","type":"enum","symbols":["A","B"]}'
    )


def test_array_field_order():
    schema = {"items": "int", "type": "array"}


    assert to_parsing_canonical_form(schema) == '{"type":"array","items":"int"}'