From 90543e804a6e57fbb26e546426d778fcfe592583 Mon Sep 17 00:00:00 2001 From: Michael Overmeyer Date: Mon, 16 Oct 2023 15:53:12 -0400 Subject: [PATCH] Shorten the error message in cases of incorrect parsing --- README.rst | 6 +++--- benchmarking/format_results.py | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.rst b/README.rst index 8173e67..30f2e7d 100644 --- a/README.rst +++ b/README.rst @@ -94,7 +94,7 @@ Parsing a timestamp with no time zone information (e.g., ``2014-01-09T21:48:00`` +--------------------------------+-----------+-----------+-----------+----------+----------+----------+-------------------------------+--------------------------------------------------+ |udatetime |709 nsec |677 nsec |692 nsec |715 nsec |705 nsec |700 nsec |586 nsec |7.5x | +--------------------------------+-----------+-----------+-----------+----------+----------+----------+-------------------------------+--------------------------------------------------+ - |str2date |6.84 usec |5.8 usec |6.86 usec |6.6 usec |6.47 usec |6.89 usec |**Incorrect Result** (``None``)|72.5x | + |str2date |6.84 usec |5.8 usec |6.86 usec |6.6 usec |6.47 usec |6.89 usec |❌ |72.5x | +--------------------------------+-----------+-----------+-----------+----------+----------+----------+-------------------------------+--------------------------------------------------+ |iso8601utils |N/A |N/A |N/A |8.64 usec |8.69 usec |9.2 usec |11.2 usec |74.0x | +--------------------------------+-----------+-----------+-----------+----------+----------+----------+-------------------------------+--------------------------------------------------+ @@ -142,7 +142,7 @@ Parsing a timestamp with time zone information (e.g., ``2014-01-09T21:48:00-05:3 +--------------------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+--------------------------------------------------+ |udatetime |828 nsec |785 nsec |805 nsec |811 nsec |798 nsec |816 nsec |768 nsec |7.8x | +--------------------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+--------------------------------------------------+ - |str2date |7.79 usec |6.86 usec |7.71 usec |7.77 usec |7.62 usec |8 usec |**Incorrect Result** (``None``)|73.6x | + |str2date |7.79 usec |6.86 usec |7.71 usec |7.77 usec |7.62 usec |8 usec |❌ |73.6x | +--------------------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+--------------------------------------------------+ |iso8601 |12.9 usec |11.6 usec |13.1 usec |12.4 usec |12.9 usec |12.6 usec |31.1 usec |121.7x | +--------------------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+--------------------------------------------------+ @@ -164,7 +164,7 @@ Parsing a timestamp with time zone information (e.g., ``2014-01-09T21:48:00-05:3 +--------------------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+--------------------------------------------------+ |metomi-isodatetime |1.24 msec |1.33 msec |1.73 msec |1.73 msec |1.73 msec |1.86 msec |N/A |11719.3x | +--------------------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+--------------------------------------------------+ - |moment |**Incorrect Result** (``None``)|**Incorrect Result** (``None``)|**Incorrect Result** (``None``)|**Incorrect Result** (``None``)|**Incorrect Result** (``None``)|**Incorrect Result** (``None``)|N/A |2116377.5x | + |moment |❌ |❌ |❌ |❌ |❌ |❌ |N/A |2116377.5x | +--------------------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+--------------------------------------------------+ ciso8601 takes 106 nsec, which is **1.9x faster than datetime (builtin)**, the next fastest Python 3.12 parser in this comparison. diff --git a/benchmarking/format_results.py b/benchmarking/format_results.py index 4c5b21d..aadf7f1 100644 --- a/benchmarking/format_results.py +++ b/benchmarking/format_results.py @@ -23,7 +23,7 @@ def __str__(self): if self.exception: return f"Raised ``{self.exception}`` Exception" elif not self.matched_expected: - return f"**Incorrect Result** (``{self.parsed_value}``)" + return "❌" else: return self.formatted_timing()