# Path: tests/test_custom.py
# class CustomAssertions:
# 
#     def assertDictEqualExt(self, result_dict, expected_dict, none_allowed=None):
#         """
#         Compare dictionaries, skip items not found in expected dictionary.
# 
#         Lists and recursion's in dictionaries are allowed.
# 
#         :param result_dict: First dictionary with results
#         :type result_dict: dict
#         :param expected_dict: Second dictionary with expected values
#         :type expected_dict: dict
#         :param none_allowed: List of fields for which None value in result_dict is allowed
#         :type none_allowed: list
# 
#         :return bool: Dictionaries are identical?
#         """
#         if none_allowed is None:
#             none_allowed = []
#         if not isinstance(expected_dict, dict):
#             if expected_dict == result_dict:
#                 return True
#             else:
#                 raise AssertionError("Different value for %s != %s" % (result_dict, expected_dict))
#         expected_keys = expected_dict.keys()
#         for k in result_dict:
#             if k not in expected_keys:
#                 continue
#             if isinstance(result_dict[k], dict):
#                 self.assertDictEqualExt(result_dict[k], expected_dict[k], none_allowed)
#             elif isinstance(result_dict[k], list):
#                 for i in range(len(result_dict[k])):
#                     if not isinstance(expected_dict[k], list):
#                         raise AssertionError("No list expected for %s attribute, expected '%s' but received: '%s'" %
#                                              (k, expected_dict[k], result_dict[k]))
#                     self.assertDictEqualExt(result_dict[k][i], expected_dict[k][i], none_allowed)
#             elif result_dict[k] != expected_dict[k]:
#                 if isinstance(result_dict[k], datetime):
#                     if result_dict[k].date() == expected_dict[k].date():
#                         continue
#                 if result_dict[k] is not None or k not in none_allowed:
#                     raise AssertionError("Different value for '%s': %s != %s" % (k, result_dict[k], expected_dict[k]))


from bitcoinlib.scripts import *
from tests.test_custom import CustomAssertions
import unittest
        self.assertEqual(s.raw, b'')

    def test_script_deserialize_sig_pk(self):
        scr = '493046022100cf4d7571dd47a4d47f5cb767d54d6702530a3555726b27b6ac56117f5e7808fe0221008cbb42233bb04d7f28a' \
              '715cf7c938e238afde90207e9d103dd9018e12cb7180e0141042daa93315eebbe2cb9b5c3505df4c6fb6caca8b75678609856' \
              '7550d4820c09db988fe9997d049d687292f815ccd6e7fb5c1b1a91137999818d17c73d0f80aef9'
        s = Script.parse_hex(scr)
        self.assertEqual(['sig_pubkey'], s.script_types)
        self.assertEqual(s.signatures[0].as_der_encoded(),
                         bytearray(b"0F\x02!\x00\xcfMuq\xddG\xa4\xd4\x7f\\\xb7g\xd5Mg\x02S\n5Urk\'\xb6\xacV"
                                   b"\x11\x7f^x\x08\xfe\x02!\x00\x8c\xbbB#;\xb0M\x7f(\xa7\x15\xcf|\x93\x8e#"
                                   b"\x8a\xfd\xe9\x02\x07\xe9\xd1\x03\xdd\x90\x18\xe1,\xb7\x18\x0e\x01"))
        self.assertEqual(s.keys[0].public_byte,
                         bytearray(b'\x04-\xaa\x931^\xeb\xbe,\xb9\xb5\xc3P]\xf4\xc6\xfbl\xac\xa8\xb7Vx`\x98'
                                   b'VuP\xd4\x82\x0c\t\xdb\x98\x8f\xe9\x99}\x04\x9dhr\x92\xf8\x15\xcc\xd6'
                                   b'\xe7\xfb\\\x1b\x1a\x91\x13y\x99\x81\x8d\x17\xc7=\x0f\x80\xae\xf9'))

    def test_script_deserialize_sig_hashtype(self):
        scr = '493046022100cf4d7571dd47a4d47f5cb767d54d6702530a3555726b27b6ac56117f5e7808fe0221008cbb42233bb04d7f28a' \
              '715cf7c938e238afde90207e9d103dd9018e12cb7180e03'
        s = Script.parse_hex(scr)
        self.assertEqual(3, s.signatures[0].hash_type)
        self.assertEqual(3, s.hash_type)
        self.assertEqual(s.keys, [])
        self.assertEqual(s.signatures[0].as_der_encoded(),
                         b"0F\x02!\x00\xcfMuq\xddG\xa4\xd4\x7f\\\xb7g\xd5Mg\x02S\n5Urk'\xb6\xacV\x11\x7f^x\x08\xfe"
                         b"\x02!\x00\x8c\xbbB#;\xb0M\x7f(\xa7\x15\xcf|\x93\x8e#"
                         b'\x8a\xfd\xe9\x02\x07\xe9\xd1\x03\xdd\x90\x18\xe1,\xb7\x18\x0e\x03')



# Path: tests/test_custom.py
# class CustomAssertions:
# 
#     def assertDictEqualExt(self, result_dict, expected_dict, none_allowed=None):
#         """
#         Compare dictionaries, skip items not found in expected dictionary.
# 
#         Lists and recursion's in dictionaries are allowed.
# 
#         :param result_dict: First dictionary with results
#         :type result_dict: dict
#         :param expected_dict: Second dictionary with expected values
#         :type expected_dict: dict
#         :param none_allowed: List of fields for which None value in result_dict is allowed
#         :type none_allowed: list
# 
#         :return bool: Dictionaries are identical?
#         """
#         if none_allowed is None:
#             none_allowed = []
#         if not isinstance(expected_dict, dict):
#             if expected_dict == result_dict:
#                 return True
#             else:
#                 raise AssertionError("Different value for %s != %s" % (result_dict, expected_dict))
#         expected_keys = expected_dict.keys()
#         for k in result_dict:
#             if k not in expected_keys:
#                 continue
#             if isinstance(result_dict[k], dict):
#                 self.assertDictEqualExt(result_dict[k], expected_dict[k], none_allowed)
#             elif isinstance(result_dict[k], list):
#                 for i in range(len(result_dict[k])):
#                     if not isinstance(expected_dict[k], list):
#                         raise AssertionError("No list expected for %s attribute, expected '%s' but received: '%s'" %
#                                              (k, expected_dict[k], result_dict[k]))
#                     self.assertDictEqualExt(result_dict[k][i], expected_dict[k][i], none_allowed)
#             elif result_dict[k] != expected_dict[k]:
#                 if isinstance(result_dict[k], datetime):
#                     if result_dict[k].date() == expected_dict[k].date():
#                         continue
#                 if result_dict[k] is not None or k not in none_allowed:
#                     raise AssertionError("Different value for '%s': %s != %s" % (k, result_dict[k], expected_dict[k]))


# Path: tests/test_script.py
from bitcoinlib.scripts import *
from tests.test_custom import CustomAssertions
import unittest

        self.assertEqual(s.raw, b'')

    def test_script_deserialize_sig_pk(self):
        scr = '493046022100cf4d7571dd47a4d47f5cb767d54d6702530a3555726b27b6ac56117f5e7808fe0221008cbb42233bb04d7f28a' \
              '715cf7c938e238afde90207e9d103dd9018e12cb7180e0141042daa93315eebbe2cb9b5c3505df4c6fb6caca8b75678609856' \
              '7550d4820c09db988fe9997d049d687292f815ccd6e7fb5c1b1a91137999818d17c73d0f80aef9'
        s = Script.parse_hex(scr)
        self.assertEqual(['sig_pubkey'], s.script_types)
        self.assertEqual(s.signatures[0].as_der_encoded(),
                         bytearray(b"0F\x02!\x00\xcfMuq\xddG\xa4\xd4\x7f\\\xb7g\xd5Mg\x02S\n5Urk\'\xb6\xacV"
                                   b"\x11\x7f^x\x08\xfe\x02!\x00\x8c\xbbB#;\xb0M\x7f(\xa7\x15\xcf|\x93\x8e#"
                                   b"\x8a\xfd\xe9\x02\x07\xe9\xd1\x03\xdd\x90\x18\xe1,\xb7\x18\x0e\x01"))
        self.assertEqual(s.keys[0].public_byte,
                         bytearray(b'\x04-\xaa\x931^\xeb\xbe,\xb9\xb5\xc3P]\xf4\xc6\xfbl\xac\xa8\xb7Vx`\x98'
                                   b'VuP\xd4\x82\x0c\t\xdb\x98\x8f\xe9\x99}\x04\x9dhr\x92\xf8\x15\xcc\xd6'
                                   b'\xe7\xfb\\\x1b\x1a\x91\x13y\x99\x81\x8d\x17\xc7=\x0f\x80\xae\xf9'))

    def test_script_deserialize_sig_hashtype(self):
        scr = '493046022100cf4d7571dd47a4d47f5cb767d54d6702530a3555726b27b6ac56117f5e7808fe0221008cbb42233bb04d7f28a' \
              '715cf7c938e238afde90207e9d103dd9018e12cb7180e03'
        s = Script.parse_hex(scr)
        self.assertEqual(3, s.signatures[0].hash_type)
        self.assertEqual(3, s.hash_type)
        self.assertEqual(s.keys, [])
        self.assertEqual(s.signatures[0].as_der_encoded(),
                         b"0F\x02!\x00\xcfMuq\xddG\xa4\xd4\x7f\\\xb7g\xd5Mg\x02S\n5Urk'\xb6\xacV\x11\x7f^x\x08\xfe"
                         b"\x02!\x00\x8c\xbbB#;\xb0M\x7f(\xa7\x15\xcf|\x93\x8e#"
                         b'\x8a\xfd\xe9\x02\x07\xe9\xd1\x03\xdd\x90\x18\xe1,\xb7\x18\x0e\x03')



class TestScript(unittest.TestCase, CustomAssertions):