URI: 
       ttests: Simplify some asserts. - obelisk - Electrum server using libbitcoin as its backend
  HTML git clone https://git.parazyd.org/obelisk
   DIR Log
   DIR Files
   DIR Refs
   DIR README
   DIR LICENSE
       ---
   DIR commit bc3c4ee24a16a7397e41262acb25f8d4ef91375c
   DIR parent f28cf131ba9a7bacfbffd4081e420ecd15e57a6f
  HTML Author: parazyd <parazyd@dyne.org>
       Date:   Thu, 15 Apr 2021 20:28:53 +0200
       
       ttests: Simplify some asserts.
       
       Diffstat:
         M obelisk/protocol.py                 |       8 +++++---
         M obelisk/zeromq.py                   |       3 ++-
         M tests/test_electrum_protocol.py     |      31 +++++++++++--------------------
       
       3 files changed, 18 insertions(+), 24 deletions(-)
       ---
   DIR diff --git a/obelisk/protocol.py b/obelisk/protocol.py
       t@@ -452,9 +452,11 @@ class ElectrumProtocol(asyncio.Protocol):  # pylint: disable=R0904,R0902
                        "height": rec["height"],
                    })
        
       -        if len(ret) >= 2:
       -            ret.reverse()
       -        return {"result": ret}
       +        if len(ret) < 2:
       +            return {"result": ret}
       +
       +        # return {"result": sorted(ret, key=lambda x: x["height"], reverse=True)}
       +        return {"result": sorted(ret, key=lambda x: x["height"])}
        
            async def scripthash_notifier(self, writer, scripthash):
                # TODO: Figure out how this actually works
   DIR diff --git a/obelisk/zeromq.py b/obelisk/zeromq.py
       t@@ -381,7 +381,8 @@ class Client:
                correlated_points = Client.__correlate(points)
                # self.log.debug("history points: %s", points)
                # self.log.debug("history correlated: %s", correlated_points)
       -        return error_code, self._sort_correlated_points(correlated_points)
       +        # return error_code, self._sort_correlated_points(correlated_points)
       +        return error_code, correlated_points
        
            @staticmethod
            def _sort_correlated_points(points):
   DIR diff --git a/tests/test_electrum_protocol.py b/tests/test_electrum_protocol.py
       t@@ -90,7 +90,7 @@ async def test_blockchain_block_headers(protocol, writer):
            params = [123, 3]
            expect = get_expect(method, params)
            data = await protocol.blockchain_block_headers(writer, {"params": params})
       -    assert data["result"]["hex"] == expect["result"]["hex"]
       +    assert data["result"] == expect["result"]
        
            # params = [123, 3, 127]
            # expect = get_expect(method, params)
       t@@ -108,8 +108,7 @@ async def test_blockchain_scripthash_get_balance(protocol, writer):
            expect = get_expect(method, params)
            data = await protocol.blockchain_scripthash_get_balance(
                writer, {"params": params})
       -    assert data["result"]["unconfirmed"] == expect["result"]["unconfirmed"]
       -    assert data["result"]["confirmed"] == expect["result"]["confirmed"]
       +    assert data["result"] == expect["result"]
        
            params = [
                "92dd1eb7c042956d3dd9185a58a2578f61fee91347196604540838ccd0f8c08c"
       t@@ -117,8 +116,7 @@ async def test_blockchain_scripthash_get_balance(protocol, writer):
            expect = get_expect(method, params)
            data = await protocol.blockchain_scripthash_get_balance(
                writer, {"params": params})
       -    assert data["result"]["unconfirmed"] == expect["result"]["unconfirmed"]
       -    assert data["result"]["confirmed"] == expect["result"]["confirmed"]
       +    assert data["result"] == expect["result"]
        
        
        async def test_blockchain_scripthash_get_history(protocol, writer):
       t@@ -129,10 +127,7 @@ async def test_blockchain_scripthash_get_history(protocol, writer):
            expect = get_expect(method, params)
            data = await protocol.blockchain_scripthash_get_history(
                writer, {"params": params})
       -    assert len(data["result"]) == len(expect["result"])
       -    for i in range(len(expect["result"])):
       -        assert data["result"][i]["tx_hash"] == expect["result"][i]["tx_hash"]
       -        assert data["result"][i]["height"] == expect["result"][i]["height"]
       +    assert data["result"] == expect["result"]
        
        
        async def test_blockchain_scripthash_listunspent(protocol, writer):
       t@@ -152,12 +147,11 @@ async def test_blockchain_scripthash_listunspent(protocol, writer):
            data = await protocol.blockchain_scripthash_listunspent(
                writer, {"params": params})
        
       -    assert len(data["result"]) == len(expect["result"])
       -    for i in range(len(expect["result"])):
       -        assert data["result"][i]["value"] == expect["result"][i]["value"]
       -        assert data["result"][i]["height"] == expect["result"][i]["height"]
       -        assert data["result"][i]["tx_pos"] == expect["result"][i]["tx_pos"]
       -        assert data["result"][i]["tx_hash"] == expect["result"][i]["tx_hash"]
       +    pprint(expect)
       +    print()
       +    pprint(data)
       +
       +    assert data["result"] == expect["result"]
        
        
        async def test_blockchain_transaction_get(protocol, writer):
       t@@ -179,9 +173,7 @@ async def test_blockchain_transaction_get_merkle(protocol, writer):
            expect = get_expect(method, params)
            data = await protocol.blockchain_transaction_get_merkle(
                writer, {"params": params})
       -    assert data["result"]["block_height"] == expect["result"]["block_height"]
       -    assert data["result"]["merkle"] == expect["result"]["merkle"]
       -    assert data["result"]["pos"] == expect["result"]["pos"]
       +    assert data["result"] == expect["result"]
        
        
        async def test_blockchain_transaction_id_from_pos(protocol, writer):
       t@@ -196,8 +188,7 @@ async def test_blockchain_transaction_id_from_pos(protocol, writer):
            expect = get_expect(method, params)
            data = await protocol.blockchain_transaction_id_from_pos(
                writer, {"params": params})
       -    assert data["result"]["tx_hash"] == expect["result"]["tx_hash"]
       -    assert data["result"]["merkle"] == expect["result"]["merkle"]
       +    assert data["result"] == expect["result"]
        
        
        async def test_server_ping(protocol, writer):