# Path: dags/operators/python_sensor.py
# class PythonSensor(airflow.operators.sensors.BaseSensorOperator):
#     '''
#     Runs Python callable until it returns `True`.
# 
#     :param python_callable: Python callable to run. It should return `True`
#         when successful, any other values (even truthy ones) won't work.
#     :type python_callable: function
#     '''
# 
#     @apply_defaults
#     def __init__(self, python_callable, *args, **kwargs):
#         super(PythonSensor, self).__init__(*args, **kwargs)
#         self.python_callable = python_callable
# 
#     def poke(self, context):
#         return self.python_callable() is True


import pytest
from dags.operators.python_sensor import PythonSensor


class TestPythonSensor(object):
    @pytest.mark.parametrize('return_value, result', [
        ('a string', False),
        (42, False),
        (0, False),
        (False, False),
        (True, True),
    ])
    def test_poke_returns_false_if_callable_doesnt_return_true(self, return_value, result):
        callable = lambda: return_value  # noqa: E731


# Path: dags/operators/python_sensor.py
# class PythonSensor(airflow.operators.sensors.BaseSensorOperator):
#     '''
#     Runs Python callable until it returns `True`.
# 
#     :param python_callable: Python callable to run. It should return `True`
#         when successful, any other values (even truthy ones) won't work.
#     :type python_callable: function
#     '''
# 
#     @apply_defaults
#     def __init__(self, python_callable, *args, **kwargs):
#         super(PythonSensor, self).__init__(*args, **kwargs)
#         self.python_callable = python_callable
# 
#     def poke(self, context):
#         return self.python_callable() is True


# Path: tests/dags/operators/test_python_sensor.py
import pytest
from dags.operators.python_sensor import PythonSensor



class TestPythonSensor(object):
    @pytest.mark.parametrize('return_value, result', [
        ('a string', False),
        (42, False),
        (0, False),
        (False, False),
        (True, True),
    ])
    def test_poke_returns_false_if_callable_doesnt_return_true(self, return_value, result):
        callable = lambda: return_value  # noqa: E731


        sensor = PythonSensor(