403Webshell
Server IP : 199.250.200.62  /  Your IP : 216.73.216.15
Web Server : Apache
System : Linux vps37394.inmotionhosting.com 3.10.0-1160.119.1.vz7.224.4 #1 SMP Mon Sep 30 15:36:27 MSK 2024 x86_64
User : jasonp18 ( 1000)
PHP Version : 7.4.33
Disable Function : exec,passthru,shell_exec,system
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : OFF
Directory :  /lib/rads/venv/lib/python3.13/site-packages/netaddr/tests/ip/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /lib/rads/venv/lib/python3.13/site-packages/netaddr/tests/ip//test_socket_module_fallback.py
import pytest

from netaddr.fbsocket import inet_ntop, inet_pton, inet_ntoa, AF_INET, AF_INET6


@pytest.mark.parametrize(
    ('actual', 'expected'),
    [
        ('0:0:0:0:0:0:0:0', '::'),
        ('0:0:0:0:0:0:0:A', '::a'),
        ('A:0:0:0:0:0:0:0', 'a::'),
        ('A:0:A:0:0:0:0:0', 'a:0:a::'),
        ('A:0:0:0:0:0:0:A', 'a::a'),
        ('0:A:0:0:0:0:0:A', '0:a::a'),
        ('A:0:A:0:0:0:0:A', 'a:0:a::a'),
        ('0:0:0:A:0:0:0:A', '::a:0:0:0:a'),
        ('0:0:0:0:A:0:0:A', '::a:0:0:a'),
        ('A:0:0:0:0:A:0:A', 'a::a:0:a'),
        ('A:0:0:A:0:0:A:0', 'a::a:0:0:a:0'),
        ('A:0:A:0:A:0:A:0', 'a:0:a:0:a:0:a:0'),
        ('0:A:0:A:0:A:0:A', '0:a:0:a:0:a:0:a'),
        ('1080:0:0:0:8:800:200C:417A', '1080::8:800:200c:417a'),
        ('FEDC:BA98:7654:3210:FEDC:BA98:7654:3210', 'fedc:ba98:7654:3210:fedc:ba98:7654:3210'),
    ],
)
def test_inet_ntop_and_inet_pton_ipv6_conversion(actual, expected):
    assert inet_ntop(AF_INET6, inet_pton(AF_INET6, actual)) == expected


def test_inet_ntoa_ipv4_exceptions():
    with pytest.raises(TypeError):
        inet_ntoa(1)

    with pytest.raises(ValueError):
        inet_ntoa('\x00')


def test_inet_pton_ipv4_exceptions():
    with pytest.raises(OSError):
        inet_pton(AF_INET, '::0x07f')

    with pytest.raises(TypeError):
        inet_pton(AF_INET, 1)


def test_inet_pton_ipv6_exceptions():
    with pytest.raises(OSError):
        inet_pton(AF_INET6, '::0x07f')

    with pytest.raises(TypeError):
        inet_pton(AF_INET6, 1)

Youez - 2016 - github.com/yon3zu
LinuXploit