Esempio n. 1
0
    def test_recognition_and_comparisons(self):
        a = Address(self.addr)
        a2 = address(self.addr)
        self.assertIsInstance(a2, Address)
        self.assertEqual(a, a2)
        self.assertEqual(a, self.addr)
        self.assertEqual(self.addr, a)
        self.assertEqual(a.is_testnet(), self.testnet)
        self.assertEqual(a2.is_testnet(), self.testnet)

        ia = IntegratedAddress(self.iaddr)
        ia2 = address(self.iaddr)
        self.assertIsInstance(ia, IntegratedAddress)
        self.assertEqual(ia, ia2)
        self.assertEqual(ia, self.iaddr)
        self.assertEqual(self.iaddr, ia)
        self.assertEqual(ia.is_testnet(), self.testnet)
        self.assertEqual(ia2.is_testnet(), self.testnet)
        self.assertEqual(ia2.get_base_address(), a)

        sa = SubAddress(self.subaddr)
        sa2 = address(self.subaddr)
        self.assertIsInstance(sa2, SubAddress)
        self.assertEqual(sa, sa2)
        self.assertEqual(sa, self.subaddr)
        self.assertEqual(self.subaddr, sa)
        self.assertEqual(sa.is_testnet(), self.testnet)
        self.assertEqual(sa2.is_testnet(), self.testnet)
Esempio n. 2
0
    def test_recognition_and_comparisons(self):
        a = Address(self.addr)
        a2 = address(self.addr)
        self.assertIsInstance(a2, Address)
        self.assertEqual(a, a2)
        self.assertEqual(a, self.addr)
        self.assertEqual(self.addr, a)
        self.assertEqual(hash(a), hash(self.addr))
        self.assertEqual(a.is_mainnet(), self.mainnet)
        self.assertEqual(a.is_testnet(), self.testnet)
        self.assertEqual(a.is_stagenet(), self.stagenet)
        self.assertEqual(a2.is_mainnet(), self.mainnet)
        self.assertEqual(a2.is_testnet(), self.testnet)
        self.assertEqual(a2.is_stagenet(), self.stagenet)

        ia = IntegratedAddress(self.iaddr)
        ia2 = address(self.iaddr)
        self.assertIsInstance(ia, IntegratedAddress)
        self.assertEqual(ia, ia2)
        self.assertEqual(ia, self.iaddr)
        self.assertEqual(self.iaddr, ia)
        self.assertEqual(hash(ia), hash(self.iaddr))
        self.assertEqual(ia.is_mainnet(), self.mainnet)
        self.assertEqual(ia.is_testnet(), self.testnet)
        self.assertEqual(ia.is_stagenet(), self.stagenet)
        self.assertEqual(ia2.is_mainnet(), self.mainnet)
        self.assertEqual(ia2.is_testnet(), self.testnet)
        self.assertEqual(ia2.is_stagenet(), self.stagenet)
        self.assertEqual(ia2.base_address(), a)

        self.assertEqual(ia.view_key(), a.view_key())
        self.assertEqual(ia.spend_key(), a.spend_key())

        sa = SubAddress(self.subaddr)
        sa2 = address(self.subaddr)
        self.assertIsInstance(sa2, SubAddress)
        self.assertEqual(sa, sa2)
        self.assertEqual(sa, self.subaddr)
        self.assertEqual(self.subaddr, sa)
        self.assertEqual(hash(sa), hash(self.subaddr))
        self.assertEqual(sa.is_mainnet(), self.mainnet)
        self.assertEqual(sa.is_testnet(), self.testnet)
        self.assertEqual(sa.is_stagenet(), self.stagenet)
        self.assertEqual(sa2.is_mainnet(), self.mainnet)
        self.assertEqual(sa2.is_testnet(), self.testnet)
        self.assertEqual(sa2.is_stagenet(), self.stagenet)

        self.assertNotEqual(a, 0)
Esempio n. 3
0
    def test_recognition_and_comparisons(self):
        a = Address(self.addr)
        a2 = address(self.addr)
        self.assertIsInstance(a2, Address)
        self.assertEqual(a, a2)
        self.assertEqual(a, self.addr)
        self.assertEqual(self.addr, a)
        self.assertEqual(hash(a), hash(self.addr))
        self.assertEqual(a.net, self.net)
        with pytest.deprecated_call():
            self.assertEqual(a.is_mainnet(), self.net == const.NET_MAIN)
        with pytest.deprecated_call():
            self.assertEqual(a.is_testnet(), self.net == const.NET_TEST)
        with pytest.deprecated_call():
            self.assertEqual(a.is_stagenet(), self.net == const.NET_STAGE)
        self.assertEqual(a2.net, self.net)
        with pytest.deprecated_call():
            self.assertEqual(a2.is_mainnet(), self.net == const.NET_MAIN)
        with pytest.deprecated_call():
            self.assertEqual(a2.is_testnet(), self.net == const.NET_TEST)
        with pytest.deprecated_call():
            self.assertEqual(a2.is_stagenet(), self.net == const.NET_STAGE)

        ia = IntegratedAddress(self.iaddr)
        ia2 = address(self.iaddr)
        self.assertIsInstance(ia, IntegratedAddress)
        self.assertEqual(ia, ia2)
        self.assertEqual(ia, self.iaddr)
        self.assertEqual(self.iaddr, ia)
        self.assertEqual(hash(ia), hash(self.iaddr))
        self.assertEqual(ia.net, self.net)
        with pytest.deprecated_call():
            self.assertEqual(ia.is_mainnet(), self.net == const.NET_MAIN)
        with pytest.deprecated_call():
            self.assertEqual(ia.is_testnet(), self.net == const.NET_TEST)
        with pytest.deprecated_call():
            self.assertEqual(ia.is_stagenet(), self.net == const.NET_STAGE)
        self.assertEqual(ia2.net, self.net)
        with pytest.deprecated_call():
            self.assertEqual(ia2.is_mainnet(), self.net == const.NET_MAIN)
        with pytest.deprecated_call():
            self.assertEqual(ia2.is_testnet(), self.net == const.NET_TEST)
        with pytest.deprecated_call():
            self.assertEqual(ia2.is_stagenet(), self.net == const.NET_STAGE)
        self.assertEqual(ia2.base_address(), a)

        self.assertEqual(ia.view_key(), a.view_key())
        self.assertEqual(ia.spend_key(), a.spend_key())

        sa = SubAddress(self.subaddr)
        sa2 = address(self.subaddr)
        self.assertIsInstance(sa2, SubAddress)
        self.assertEqual(sa, sa2)
        self.assertEqual(sa, self.subaddr)
        self.assertEqual(self.subaddr, sa)
        self.assertEqual(hash(sa), hash(self.subaddr))
        self.assertEqual(sa.net, self.net)
        with pytest.deprecated_call():
            self.assertEqual(sa.is_mainnet(), self.net == const.NET_MAIN)
        with pytest.deprecated_call():
            self.assertEqual(sa.is_testnet(), self.net == const.NET_TEST)
        with pytest.deprecated_call():
            self.assertEqual(sa.is_stagenet(), self.net == const.NET_STAGE)
        self.assertEqual(sa2.net, self.net)
        with pytest.deprecated_call():
            self.assertEqual(sa2.is_mainnet(), self.net == const.NET_MAIN)
        with pytest.deprecated_call():
            self.assertEqual(sa2.is_testnet(), self.net == const.NET_TEST)
        with pytest.deprecated_call():
            self.assertEqual(sa2.is_stagenet(), self.net == const.NET_STAGE)

        self.assertNotEqual(a, 0)