Skip to content

Commit

Permalink
Allow NaN equality
Browse files Browse the repository at this point in the history
  • Loading branch information
kylebarron committed Apr 19, 2024
1 parent 5c028ae commit 85b17ac
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions tests/test_arrow.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import json
import math
from pathlib import Path
from typing import Any, Dict, Sequence, Union

Expand Down Expand Up @@ -84,6 +85,10 @@ def assert_number_equal(
key_name: str,
) -> None:
"""Compare two JSON numbers"""
# Allow NaN equality
if math.isnan(result) and math.isnan(expected):
return

assert abs(result - expected) <= precision, (
f"Number at {key_name} not within precision. "
f"{result=}, {expected=}, {precision=}."
Expand Down

0 comments on commit 85b17ac

Please sign in to comment.