# End File Logic
-# Helper Functions
-def mock_url_open(url):
- """
- Mock of `urlopen` that returns the url in a `BytesIO` stream.
-
- Parameters
- ----------
- url : str
- The URL associated with the file to open.
-
- Returns
- -------
- bytes_stream : BytesIO
- The `url` input wrapped in a `BytesIO` stream.
- """
-
- return BytesIO(url)
-
-
-def mock_url_open_fail(_):
- """
- Mock of `urlopen` that fails with an Exception.
- """
-
- raise Exception()
-
-
-def mock_url_open_read_fail(_):
- """
- Mock of `urlopen` that returns an object that fails on `read`.
-
- Returns
- -------
- file_mock : mock.Mock
- A mock of a file object that fails when reading.
- """
-
- def fail_read():
- raise Exception()
-
- m = mock.Mock()
-
- m.read = fail_read
- return m
-
-
-def mock_url_open_decode_fail(_):
- """
- Mock of `urlopen` that returns an object that fails on during decoding
- the output of `urlopen`.
-
- Returns
- -------
- file_mock : mock.Mock
- A mock of a file object that fails when decoding the output.
- """
-
- def fail_decode(_):
- raise Exception()
-
- def read():
- s = mock.Mock()
- s.decode = fail_decode
-
- return s
-
- m = mock.Mock()
- m.read = read
- return m
-
-
class DomainToIDNA(Base):
def __init__(self, *args, **kwargs):
super(DomainToIDNA, self).__init__(*args, **kwargs)