<s> import os <EOL> import socket <EOL> import unittest <EOL> import doctest <EOL> def docs_path ( * parts ) : <EOL> return os . path . join ( os . path . dirname ( os . path . dirname ( __file__ ) ) , * parts ) <EOL> def crate_path ( * parts ) : <EOL> return os . path . abspath ( docs_path ( '<STR_LIT:..>' , '<STR_LIT:..>' , '<STR_LIT>' , '<STR_LIT>' , * parts ) ) <EOL> def public_ip ( ) : <EOL> """<STR_LIT>""" <EOL> for addrinfo in socket . getaddrinfo ( socket . gethostname ( ) , None ) : <EOL> if addrinfo [ <NUM_LIT:1> ] in ( socket . SOCK_STREAM , socket . SOCK_DGRAM ) and addrinfo [ <NUM_LIT:0> ] == socket . AF_INET : <EOL> return addrinfo [ <NUM_LIT:4> ] [ <NUM_LIT:0> ] <EOL> return socket . gethostbyname ( socket . gethostname ( ) ) <EOL> def setUp ( test ) : <EOL> test . globs [ '<STR_LIT>' ] = crate_path <EOL> test . globs [ '<STR_LIT>' ] = public_ip ( ) <EOL> def test_suite ( ) : <EOL> suite = unittest . TestSuite ( ) <EOL> s = doctest . DocFileSuite ( '<STR_LIT>' , <EOL> setUp = setUp , <EOL> optionflags = doctest . NORMALIZE_WHITESPACE | <EOL> doctest . ELLIPSIS , <EOL> encoding = '<STR_LIT:utf-8>' ) <EOL> suite . addTest ( s ) <EOL> return suite </s>
