From 85b17ac07cc8553690cafa276dc080fbfb916872 Mon Sep 17 00:00:00 2001 From: Kyle Barron Date: Fri, 19 Apr 2024 18:06:09 -0400 Subject: [PATCH] Allow NaN equality --- tests/test_arrow.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/test_arrow.py b/tests/test_arrow.py index ef9ed95..19c3311 100644 --- a/tests/test_arrow.py +++ b/tests/test_arrow.py @@ -1,4 +1,5 @@ import json +import math from pathlib import Path from typing import Any, Dict, Sequence, Union @@ -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=}."