# Path: px/px_file.py
# class PxFileBuilder:
# class PxFile(object):
#     def __init__(self):
#     def build(self):
#     def __repr__(self):
#     def __init__(self, pid, filetype):
#     def __repr__(self):
#     def __eq__(self, other):
#     def __ne__(self, other):
#     def __hash__(self):
#     def __str__(self):
#     def _resolve_name(self):
#     def device_number(self):
#     def fifo_id(self):
#     def get_endpoints(self):
# def resolve_endpoint(endpoint):
# def call_lsof():
# def lsof_to_files(lsof):
# def get_all():


import re
import sys
from px import px_file
    from typing import List  # NOQA
        is None
    )
    assert (
        lsof_to_file(
            ["p123", "f6", "au", "tIPv4", "d0x42", "n*:57919"]
        ).get_endpoints()[1]
        is None
    )

    assert (
        lsof_to_file(["p123", "f6", "au", "tIPv4", "d0x42", "n*:*"]).get_endpoints()[1]
        is None
    )
    assert (
        lsof_to_file(
            ["p123", "f6", "aw", "tREG", "d0x42", "n/somefile"]
        ).get_endpoints()[1]
        is None
    )


def test_str_resolve():
    # FIXME: This will break if Google changes the name of 8.8.8.8
    test_me = px_file.PxFile(pid=0, filetype="IPv4")
    test_me.name = "127.0.0.1:51786->8.8.8.8:https"
    assert str(test_me) in [
        "[IPv4] localhost:51786->google-public-dns-a.google.com:https",
        "[IPv4] localhost:51786->dns.google:https",
    ]


# Path: px/px_file.py
# class PxFileBuilder:
# class PxFile(object):
#     def __init__(self):
#     def build(self):
#     def __repr__(self):
#     def __init__(self, pid, filetype):
#     def __repr__(self):
#     def __eq__(self, other):
#     def __ne__(self, other):
#     def __hash__(self):
#     def __str__(self):
#     def _resolve_name(self):
#     def device_number(self):
#     def fifo_id(self):
#     def get_endpoints(self):
# def resolve_endpoint(endpoint):
# def call_lsof():
# def lsof_to_files(lsof):
# def get_all():


# Path: tests/px_file_test.py
import re
import sys
from px import px_file
    from typing import List  # NOQA

        is None
    )
    assert (
        lsof_to_file(
            ["p123", "f6", "au", "tIPv4", "d0x42", "n*:57919"]
        ).get_endpoints()[1]
        is None
    )

    assert (
        lsof_to_file(["p123", "f6", "au", "tIPv4", "d0x42", "n*:*"]).get_endpoints()[1]
        is None
    )
    assert (
        lsof_to_file(
            ["p123", "f6", "aw", "tREG", "d0x42", "n/somefile"]
        ).get_endpoints()[1]
        is None
    )


def test_str_resolve():
    # FIXME: This will break if Google changes the name of 8.8.8.8
    test_me = px_file.PxFile(pid=0, filetype="IPv4")
    test_me.name = "127.0.0.1:51786->8.8.8.8:https"
    assert str(test_me) in [
        "[IPv4] localhost:51786->google-public-dns-a.google.com:https",
        "[IPv4] localhost:51786->dns.google:https",
    ]


    test_me = px_file.PxFile(pid=0, filetype="IPv4")