# Path: bit/network/meta.py
# class Unspent:
#     """Represents an unspent transaction output (UTXO)."""
# 
#     __slots__ = ('amount', 'confirmations', 'script', 'txid', 'txindex', 'type', 'vsize', 'segwit', 'sequence')
# 
#     def __init__(self, amount, confirmations, script, txid, txindex, type='p2pkh', vsize=None, segwit=None,
#                  sequence=int.from_bytes(SEQUENCE, byteorder='little')):
#         self.amount = amount
#         self.confirmations = confirmations
#         self.script = script
#         self.txid = txid
#         self.txindex = txindex
#         self.type = type if type in UNSPENT_TYPES else 'unknown'
#         self.vsize = vsize if vsize else UNSPENT_TYPES[self.type]['vsize']
#         self.segwit = UNSPENT_TYPES[self.type]['segwit']
#         self.sequence = sequence
# 
#     def to_dict(self):
#         return {attr: getattr(self, attr) for attr in Unspent.__slots__}
# 
#     @classmethod
#     def from_dict(cls, d):
#         return Unspent(**{attr: d[attr] for attr in Unspent.__slots__})
# 
#     def __eq__(self, other):
#         return (
#             self.amount == other.amount
#             and self.script == other.script
#             and self.txid == other.txid
#             and self.txindex == other.txindex
#             and self.segwit == other.segwit
#             and self.sequence == other.sequence
#         )
# 
#     def __repr__(self):
#         return 'Unspent(amount={}, confirmations={}, script={}, txid={}, txindex={}, segwit={}, sequence={})'.format(
#             repr(self.amount),
#             repr(self.confirmations),
#             repr(self.script),
#             repr(self.txid),
#             repr(self.txindex),
#             repr(self.segwit),
#             repr(self.sequence)
#         )
# 
#     def set_type(self, type, vsize=0):
#         self.type = type if type in UNSPENT_TYPES else 'unknown'
#         self.vsize = vsize if vsize else UNSPENT_TYPES[self.type]['vsize']
#         self.segwit = UNSPENT_TYPES[self.type]['segwit']
#         return self
# 
#     def opt_in_for_RBF(self):
#         if self.sequence > 4294967293:
#             self.sequence = 4294967293


from bit.network.meta import Unspent


class TestUnspent:
    def test_init(self):
        unspent = Unspent(10000, 7, 'script', 'txid', 0)
        assert unspent.amount == 10000
        assert unspent.confirmations == 7
        assert unspent.script == 'script'
        assert unspent.txid == 'txid'
        assert unspent.txindex == 0

    def test_dict_conversion(self):

# Path: bit/network/meta.py
# class Unspent:
#     """Represents an unspent transaction output (UTXO)."""
# 
#     __slots__ = ('amount', 'confirmations', 'script', 'txid', 'txindex', 'type', 'vsize', 'segwit', 'sequence')
# 
#     def __init__(self, amount, confirmations, script, txid, txindex, type='p2pkh', vsize=None, segwit=None,
#                  sequence=int.from_bytes(SEQUENCE, byteorder='little')):
#         self.amount = amount
#         self.confirmations = confirmations
#         self.script = script
#         self.txid = txid
#         self.txindex = txindex
#         self.type = type if type in UNSPENT_TYPES else 'unknown'
#         self.vsize = vsize if vsize else UNSPENT_TYPES[self.type]['vsize']
#         self.segwit = UNSPENT_TYPES[self.type]['segwit']
#         self.sequence = sequence
# 
#     def to_dict(self):
#         return {attr: getattr(self, attr) for attr in Unspent.__slots__}
# 
#     @classmethod
#     def from_dict(cls, d):
#         return Unspent(**{attr: d[attr] for attr in Unspent.__slots__})
# 
#     def __eq__(self, other):
#         return (
#             self.amount == other.amount
#             and self.script == other.script
#             and self.txid == other.txid
#             and self.txindex == other.txindex
#             and self.segwit == other.segwit
#             and self.sequence == other.sequence
#         )
# 
#     def __repr__(self):
#         return 'Unspent(amount={}, confirmations={}, script={}, txid={}, txindex={}, segwit={}, sequence={})'.format(
#             repr(self.amount),
#             repr(self.confirmations),
#             repr(self.script),
#             repr(self.txid),
#             repr(self.txindex),
#             repr(self.segwit),
#             repr(self.sequence)
#         )
# 
#     def set_type(self, type, vsize=0):
#         self.type = type if type in UNSPENT_TYPES else 'unknown'
#         self.vsize = vsize if vsize else UNSPENT_TYPES[self.type]['vsize']
#         self.segwit = UNSPENT_TYPES[self.type]['segwit']
#         return self
# 
#     def opt_in_for_RBF(self):
#         if self.sequence > 4294967293:
#             self.sequence = 4294967293


# Path: tests/network/test_meta.py
from bit.network.meta import Unspent



class TestUnspent:
    def test_init(self):
        unspent = Unspent(10000, 7, 'script', 'txid', 0)
        assert unspent.amount == 10000
        assert unspent.confirmations == 7
        assert unspent.script == 'script'
        assert unspent.txid == 'txid'
        assert unspent.txindex == 0

    def test_dict_conversion(self):

        unspent = Unspent(10000, 7, 'script', 'txid', 0)