Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions tests/test_sorts.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
on a graph, and ``stalin_sort``/``wiggle_sort`` deliberately do not fully sort).
"""

from dataclasses import dataclass
from typing import NamedTuple

import pytest

from sorts.binary_insertion_sort import binary_insertion_sort
Expand Down Expand Up @@ -69,6 +72,20 @@ def test_heap_sort():
strand_sort,
)


@dataclass(order=True)
class Person:
name: str = "Bob"
age: int = 37
cost: float = 0.0


class Dog(NamedTuple):
name: str = "Fido"
age: int = 5
weight: float = 15.5


CASES = (
[],
[1],
Expand All @@ -79,6 +96,8 @@ def test_heap_sort():
[5, 4, 3, 2, 1],
[1, 2, 3, 4, 5],
[-2, -2, 0, 0, 7, 7],
[Person(cost=100.0), Person(cost=-100.0), Person(name="Al")],
[Dog(weight=15.5), Dog(weight=15.1), Dog(name="Buddy")],
)


Expand Down
Loading