
import pytest

import manipulator_util


class TestManipulatorManager(object):

    def pytest_funcarg__manager(self, request):
        return manipulator_util.ManipulatorManager(None, {}, 0)

    def test_in_schedule_fragment(self):
        in_schedule_fragment = (
            manipulator_util.ManipulatorManager.in_schedule_fragment)
        assert in_schedule_fragment(0, [0, 3600])
        assert in_schedule_fragment(1800, [0, 3600])
        assert in_schedule_fragment(3599, [0, 3600])
        assert not in_schedule_fragment(3600, [0, 3600])
        assert not in_schedule_fragment(5400, [0, 3600])

    def test_are_auto_manipulator_scheduled_disabled(self, manager):
        manager.set_auto_manipulator_schedules(False, [0, 3600])
        assert not manager.are_auto_manipulator_scheduled(0)


def main():
    import doctest
    doctest.testmod(manipulator_util)
    pytest.main(args=[__file__.replace('.pyc', '.py')])


if __name__ == '__main__':
    main()


import pytest

import manipulator_util


class TestManipulatorManager(object):

    def pytest_funcarg__manager(self, request):
        return manipulator_util.ManipulatorManager(None, {}, 0)

    def test_in_schedule_fragment(self):
        in_schedule_fragment = (
            manipulator_util.ManipulatorManager.in_schedule_fragment)
        assert in_schedule_fragment(0, [0, 3600])
        assert in_schedule_fragment(1800, [0, 3600])
        assert in_schedule_fragment(3599, [0, 3600])
        assert not in_schedule_fragment(3600, [0, 3600])
        assert not in_schedule_fragment(5400, [0, 3600])

    def test_are_auto_manipulator_scheduled_disabled(self, manager):
        manager.set_auto_manipulator_schedules(False, [[0, 3600]])
        assert not manager.are_auto_manipulator_scheduled(0)

    def test_are_auto_manipulator_scheduled_one_fragment(self, manager):
        manager.set_auto_manipulator_schedules(True, [[0, 3600]])
        assert manager.are_auto_manipulator_scheduled(0)
        assert manager.are_auto_manipulator_scheduled(1800)
        assert manager.are_auto_manipulator_scheduled(3599)
        assert not manager.are_auto_manipulator_scheduled(3600)
        assert not manager.are_auto_manipulator_scheduled(5400)


def main():
    import doctest
    doctest.testmod(manipulator_util)
    pytest.main(args=[__file__.replace('.pyc', '.py')])


if __name__ == '__main__':
    main()

Add a test for one schedule fragment.
Add a test for one schedule fragment.

  
  import pytest
  
  import manipulator_util
  
  
  class TestManipulatorManager(object):
  
      def pytest_funcarg__manager(self, request):
          return manipulator_util.ManipulatorManager(None, {}, 0)
  
      def test_in_schedule_fragment(self):
          in_schedule_fragment = (
              manipulator_util.ManipulatorManager.in_schedule_fragment)
          assert in_schedule_fragment(0, [0, 3600])
          assert in_schedule_fragment(1800, [0, 3600])
          assert in_schedule_fragment(3599, [0, 3600])
          assert not in_schedule_fragment(3600, [0, 3600])
          assert not in_schedule_fragment(5400, [0, 3600])
  
      def test_are_auto_manipulator_scheduled_disabled(self, manager):
-         manager.set_auto_manipulator_schedules(False, [0, 3600])
+         manager.set_auto_manipulator_schedules(False, [[0, 3600]])
          assert not manager.are_auto_manipulator_scheduled(0)
+ 
+     def test_are_auto_manipulator_scheduled_one_fragment(self, manager):
+         manager.set_auto_manipulator_schedules(True, [[0, 3600]])
+         assert manager.are_auto_manipulator_scheduled(0)
+         assert manager.are_auto_manipulator_scheduled(1800)
+         assert manager.are_auto_manipulator_scheduled(3599)
+         assert not manager.are_auto_manipulator_scheduled(3600)
+         assert not manager.are_auto_manipulator_scheduled(5400)
  
  
  def main():
      import doctest
      doctest.testmod(manipulator_util)
      pytest.main(args=[__file__.replace('.pyc', '.py')])
  
  
  if __name__ == '__main__':
      main()
  
Add a test for one schedule fragment.
## Code Before:

import pytest

import manipulator_util


class TestManipulatorManager(object):

    def pytest_funcarg__manager(self, request):
        return manipulator_util.ManipulatorManager(None, {}, 0)

    def test_in_schedule_fragment(self):
        in_schedule_fragment = (
            manipulator_util.ManipulatorManager.in_schedule_fragment)
        assert in_schedule_fragment(0, [0, 3600])
        assert in_schedule_fragment(1800, [0, 3600])
        assert in_schedule_fragment(3599, [0, 3600])
        assert not in_schedule_fragment(3600, [0, 3600])
        assert not in_schedule_fragment(5400, [0, 3600])

    def test_are_auto_manipulator_scheduled_disabled(self, manager):
        manager.set_auto_manipulator_schedules(False, [0, 3600])
        assert not manager.are_auto_manipulator_scheduled(0)


def main():
    import doctest
    doctest.testmod(manipulator_util)
    pytest.main(args=[__file__.replace('.pyc', '.py')])


if __name__ == '__main__':
    main()

## Instruction:
Add a test for one schedule fragment.
## Code After:

import pytest

import manipulator_util


class TestManipulatorManager(object):

    def pytest_funcarg__manager(self, request):
        return manipulator_util.ManipulatorManager(None, {}, 0)

    def test_in_schedule_fragment(self):
        in_schedule_fragment = (
            manipulator_util.ManipulatorManager.in_schedule_fragment)
        assert in_schedule_fragment(0, [0, 3600])
        assert in_schedule_fragment(1800, [0, 3600])
        assert in_schedule_fragment(3599, [0, 3600])
        assert not in_schedule_fragment(3600, [0, 3600])
        assert not in_schedule_fragment(5400, [0, 3600])

    def test_are_auto_manipulator_scheduled_disabled(self, manager):
        manager.set_auto_manipulator_schedules(False, [[0, 3600]])
        assert not manager.are_auto_manipulator_scheduled(0)

    def test_are_auto_manipulator_scheduled_one_fragment(self, manager):
        manager.set_auto_manipulator_schedules(True, [[0, 3600]])
        assert manager.are_auto_manipulator_scheduled(0)
        assert manager.are_auto_manipulator_scheduled(1800)
        assert manager.are_auto_manipulator_scheduled(3599)
        assert not manager.are_auto_manipulator_scheduled(3600)
        assert not manager.are_auto_manipulator_scheduled(5400)


def main():
    import doctest
    doctest.testmod(manipulator_util)
    pytest.main(args=[__file__.replace('.pyc', '.py')])


if __name__ == '__main__':
    main()
