Commit a9443060 authored by Kirill Smelkov's avatar Kirill Smelkov

amari.kpi: tests: Use %r instead of %s to workaround float-point rounding

For py3 it does not matter, but on py2 %s prettifies result a bit:

    kirr@deca:~$ python
    Python 2.7.18 (default, Jul 14 2021, 08:11:37)
    >>> str(0.1-0.01)
    '0.09'
    >>> repr(0.1-0.01)
    '0.09000000000000001'

    kirr@deca:~$ python3
    Python 3.9.2 (default, Feb 28 2021, 17:03:44)
    >>> str(0.1-0.01)
    '0.09000000000000001'
    >>> repr(0.1-0.01)
    '0.09000000000000001'

Should make the diff in between master and py2 a bit smaller.
parent 8a079af9
......@@ -621,8 +621,8 @@ def test_jdrb_stats():
assert jdrb_stats(100, {5: drb_trx(0.1,1234, 0.2,4321),
9: drb_trx(1.1,7777, 1.2,8888)}) == ( \
'{"message": "x.drb_stats", "utc": 100, "qci_dict":' + \
' {"5": {"dl_tx_bytes": 1234, "dl_tx_time": %(0.1+x)s, "dl_tx_time_notailtti": %(0.1-x)s,' + \
' "ul_tx_bytes": 4321, "ul_tx_time": %(0.2+x)s, "ul_tx_time_notailtti": %(0.2-x)s,' + \
' {"5": {"dl_tx_bytes": 1234, "dl_tx_time": %(0.1+x)r, "dl_tx_time_notailtti": %(0.1-x)r,' + \
' "ul_tx_bytes": 4321, "ul_tx_time": %(0.2+x)r, "ul_tx_time_notailtti": %(0.2-x)r,' + \
' "dl_tx_time_err": 0, "ul_tx_time_err": 0, "dl_tx_time_notailtti_err": 0, "ul_tx_time_notailtti_err": 0},' + \
' "9": {"dl_tx_bytes": 7777, "dl_tx_time": 1.11, "dl_tx_time_notailtti": 1.09,' + \
' "ul_tx_bytes": 8888, "ul_tx_time": 1.21, "ul_tx_time_notailtti": 1.19,' + \
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment