# Path: zdict/easter_eggs.py
# def import_pyjokes_module():
#     if importlib.util.find_spec('pyjokes'):
#         return importlib.import_module('pyjokes')
# 
# def get_pyjoke(pyjokes, word: str):
#     if not pyjokes:
#         return
# 
#     try:
#         # very basic string searching in jokes
#         r = random.choice(
#             list(filter(
#                 lambda j: word in map(
#                     lambda x: ''.join(c for c in x if c.isalnum()),
#                     j.split()
#                 ),
#                 pyjokes.get_jokes()
#             ))
#         )
#     except IndexError:
#         return
#     else:
#         return Record(word=word, content=r, source='pyjokes')


from zdict.easter_eggs import (import_pyjokes_module, get_pyjoke)
from unittest.mock import patch
    import pyjokes



def test_import_pyjokes_module():
    with patch('importlib.util.find_spec', return_value=None):
        assert import_pyjokes_module() is None


# Path: zdict/easter_eggs.py
# def import_pyjokes_module():
#     if importlib.util.find_spec('pyjokes'):
#         return importlib.import_module('pyjokes')
# 
# def get_pyjoke(pyjokes, word: str):
#     if not pyjokes:
#         return
# 
#     try:
#         # very basic string searching in jokes
#         r = random.choice(
#             list(filter(
#                 lambda j: word in map(
#                     lambda x: ''.join(c for c in x if c.isalnum()),
#                     j.split()
#                 ),
#                 pyjokes.get_jokes()
#             ))
#         )
#     except IndexError:
#         return
#     else:
#         return Record(word=word, content=r, source='pyjokes')


# Path: zdict/tests/test_easter_eggs.py
from zdict.easter_eggs import (import_pyjokes_module, get_pyjoke)
from unittest.mock import patch
    import pyjokes




def test_import_pyjokes_module():
    with patch('importlib.util.find_spec', return_value=None):
        assert import_pyjokes_module() is None


    assert import_pyjokes_module().__name__ == 'pyjokes'