added test for printing NaN (Not a Number)

pull/550/head
Holger Müller 2022-09-18 18:32:35 +02:00
rodzic 879d5ddea3
commit 8e73456668
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 2FDB49E81EAE6622
3 zmienionych plików z 8 dodań i 3 usunięć

Wyświetl plik

@ -1,8 +1,10 @@
Changelog Changelog
========= =========
0.5.4 0.5.4-pre
----- ---------
- Refectoring of Analysis modules
0.5.3 0.5.3
----- -----

Wyświetl plik

@ -19,6 +19,8 @@ Latest Changes
### Changes in 0.5.4-pre ### Changes in 0.5.4-pre
- Refactoring of Analysis modules
### Changes in 0.5.3 ### Changes in 0.5.3
- Python 3.10 compatability fixes - Python 3.10 compatability fixes

Wyświetl plik

@ -17,7 +17,7 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>. # along with this program. If not, see <https://www.gnu.org/licenses/>.
import unittest import unittest
from math import inf from math import inf, nan
from decimal import Decimal # Needed for test_representation() from decimal import Decimal # Needed for test_representation()
# Import targets to be tested # Import targets to be tested
@ -81,6 +81,7 @@ class TestTSIToolsValue(unittest.TestCase):
self.assertEqual(str(Value(1e24)), "1.00000Y") self.assertEqual(str(Value(1e24)), "1.00000Y")
self.assertEqual(str(Value(1e27)), "\N{INFINITY}") self.assertEqual(str(Value(1e27)), "\N{INFINITY}")
self.assertEqual(str(Value(-1e27)), "-\N{INFINITY}") self.assertEqual(str(Value(-1e27)), "-\N{INFINITY}")
self.assertEqual(str(Value(nan)), "NaN")
self.assertEqual(float(Value(1e27)), 1e27) self.assertEqual(float(Value(1e27)), 1e27)
self.assertEqual( self.assertEqual(
str(Value(11, fmt=Format(printable_max=10))), '') str(Value(11, fmt=Format(printable_max=10))), '')