diff --git a/.gitignore b/.gitignore index a2340bf..d27df2c 100644 --- a/.gitignore +++ b/.gitignore @@ -159,3 +159,4 @@ dmypy.json .pyre/ /docs/source/_autosummary/ +/sbscorer/sblegos/TransactionAnalyserTest.py diff --git a/test/sblegos/TransactionAnalyserTest.py b/test/sblegos/TransactionAnalyserTest.py index b25f623..1243dcc 100644 --- a/test/sblegos/TransactionAnalyserTest.py +++ b/test/sblegos/TransactionAnalyserTest.py @@ -58,6 +58,10 @@ def test_has_interacted_with_contributor(self): address = "0x000b94c47e4a8d7a70be12c50fc35722a7596972" self.assertFalse(self.tx_analyser.has_interacted_with_other_contributor(address)) + def test_count_interacted_with_contributor(self): + address = "0xlcsad8bc3dfbe42d9a87686f67c69001a2006da4" + self.assertEqual(1, self.tx_analyser.count_interaction_with_other_contributor(address)) + def test_has_interacted_with_contributor_true(self): address = "0xlcsad8bc3dfbe42d9a87686f67c69001a2006da4" self.assertTrue(self.tx_analyser.has_interacted_with_other_contributor(address)) diff --git a/test/sblegos/TransactionAnalyserTestCodium.py b/test/sblegos/TransactionAnalyserTestCodium.py new file mode 100644 index 0000000..1663724 --- /dev/null +++ b/test/sblegos/TransactionAnalyserTestCodium.py @@ -0,0 +1,38 @@ +import unittest + +import pandas as pd + +from sbscorer.sblegos.TransactionAnalyser import TransactionAnalyser + + +class TransactionAnalyserTestCodium(unittest.TestCase): + + # Tests that the class can be instantiated with a valid dataframe of transactions and addresses + def test_instantiation(self): + df_transactions = pd.DataFrame() + df_address = pd.DataFrame() + ta = TransactionAnalyser(df_transactions, df_address) + self.assertIsInstance(ta, TransactionAnalyser) + + # Tests that the set_seed_wallet_naive method sets the seed wallet dataframe correctly + def test_set_seed_wallet_naive(self): + df_transactions = pd.DataFrame({ + 'from_address': ['0x1', '0x2', '0x3'], + 'to_address': ['0x4', '0x5', '0x6'], + 'block_timestamp': [1, 2, 3], + 'EOA': ['0x1', '0x2', '0x3'] + }) + + df_address = pd.DataFrame() + ta = TransactionAnalyser(df_transactions, df_address) + ta.set_seed_wallet_naive() + df_expected_seed = pd.DataFrame({ + 'from_address': ['0x1', '0x2', '0x3'], + 'to_address': ['0x4', '0x5', '0x6'] + }, + index=['0x1', '0x2', '0x3']) + self.assertEqual(ta.df_seed_wallet_naive.to_dict(), df_expected_seed.to_dict()) + + +if __name__ == '__main__': + unittest.main()