Change tests from unittest to pytest
This commit is contained in:
parent
e135830b5d
commit
54fb7713a0
1
tests/blocks/12498502.json
Normal file
1
tests/blocks/12498502.json
Normal file
File diff suppressed because one or more lines are too long
@ -1,5 +1,3 @@
|
||||
import unittest
|
||||
|
||||
from mev_inspect.aave_liquidations import get_liquidations
|
||||
from mev_inspect.schemas.liquidations import Liquidation
|
||||
from mev_inspect.schemas.classified_traces import Protocol
|
||||
@ -7,8 +5,7 @@ from mev_inspect.classifiers.trace import TraceClassifier
|
||||
from tests.utils import load_test_block
|
||||
|
||||
|
||||
class TestAaveLiquidations(unittest.TestCase):
|
||||
def test_single_weth_liquidation(self):
|
||||
def test_single_weth_liquidation():
|
||||
|
||||
transaction_hash = (
|
||||
"0xb7575eedc9d8cfe82c4a11cd1a851221f2eafb93d738301995ac7103ffe877f7"
|
||||
@ -32,10 +29,10 @@ class TestAaveLiquidations(unittest.TestCase):
|
||||
classified_traces = trace_classifier.classify(block.traces)
|
||||
result = get_liquidations(classified_traces)
|
||||
|
||||
self.assertEqual(result[0], liquidation)
|
||||
self.assertEqual(len(result), 1)
|
||||
assert result[0] == liquidation and len(result) == 1
|
||||
|
||||
def test_single_liquidation(self):
|
||||
|
||||
def test_single_liquidation():
|
||||
|
||||
transaction_hash = (
|
||||
"0xe6c0e3ef0436cb032e1ef292141f4fc4dcd47a75a2559602133114952190e76b"
|
||||
@ -59,10 +56,10 @@ class TestAaveLiquidations(unittest.TestCase):
|
||||
classified_traces = trace_classifier.classify(block.traces)
|
||||
result = get_liquidations(classified_traces)
|
||||
|
||||
self.assertEqual(result[0], liquidation)
|
||||
self.assertEqual(len(result), 1)
|
||||
assert result[0] == liquidation and len(result) == 1
|
||||
|
||||
def test_single_liquidation_2(self):
|
||||
|
||||
def test_single_liquidation_2():
|
||||
|
||||
transaction_hash = (
|
||||
"0x7369b6c1e1b15a761cad3e618b4df2eb84747c58fa34230e752cc2eaf241c493"
|
||||
@ -86,20 +83,14 @@ class TestAaveLiquidations(unittest.TestCase):
|
||||
classified_traces = trace_classifier.classify(block.traces)
|
||||
result = get_liquidations(classified_traces)
|
||||
|
||||
self.assertEqual(result[1], liquidation)
|
||||
self.assertEqual(len(result), 2)
|
||||
assert result[1] == liquidation and len(result) == 2
|
||||
|
||||
def multiple_liquidations_in_block(self):
|
||||
|
||||
transaction1 = (
|
||||
"0xedd062c3a728db4b114f2e83cac281d19a9f753e36afa8a35cdbdf1e1dd5d017"
|
||||
)
|
||||
transaction2 = (
|
||||
"0x18492f250cf4735bd67a21c6cc26b7d9c59cf2fb077356dc924f36bc68a810e5"
|
||||
)
|
||||
transaction3 = (
|
||||
"0x191b05b28ebaf460e38e90ac6a801681b500f169041ae83a45b32803ef2ec98c"
|
||||
)
|
||||
def multiple_liquidations_in_block():
|
||||
|
||||
transaction1 = "0xedd062c3a728db4b114f2e83cac281d19a9f753e36afa8a35cdbdf1e1dd5d017"
|
||||
transaction2 = "0x18492f250cf4735bd67a21c6cc26b7d9c59cf2fb077356dc924f36bc68a810e5"
|
||||
transaction3 = "0x191b05b28ebaf460e38e90ac6a801681b500f169041ae83a45b32803ef2ec98c"
|
||||
block_number = 12498502
|
||||
|
||||
liquidation1 = Liquidation(
|
||||
@ -111,6 +102,7 @@ class TestAaveLiquidations(unittest.TestCase):
|
||||
received_amount=10111753901939162887,
|
||||
protocol=Protocol.aave,
|
||||
transaction_hash=transaction1,
|
||||
block_number=block_number,
|
||||
)
|
||||
|
||||
liquidation2 = Liquidation(
|
||||
@ -141,9 +133,7 @@ class TestAaveLiquidations(unittest.TestCase):
|
||||
trace_classifier = TraceClassifier()
|
||||
classified_traces = trace_classifier(block.traces)
|
||||
result = get_liquidations(classified_traces)
|
||||
|
||||
self.assertEqual(result, [liquidation1, liquidation2, liquidation3])
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
assert result[0] == liquidation1
|
||||
assert result[1] == liquidation2
|
||||
assert result[2] == liquidation3
|
||||
assert len(result) == 3
|
||||
|
Loading…
x
Reference in New Issue
Block a user