diff --git a/.travis.yml b/.travis.yml index c126d99..8ff4ca0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,4 +1,4 @@ language: python python: - - "2.7" + - "3" script: python -m doctest README.md diff --git a/README.md b/README.md index ff90f8f..60dd015 100644 --- a/README.md +++ b/README.md @@ -38,7 +38,7 @@ The logic delegate can respond by setting the elevator to move up, move down, or >>> class Elevator(Elevator): ... def __init__(self, logic_delegate, starting_floor=1): ... self._current_floor = starting_floor - ... print "%s..." % starting_floor, + ... print(f"{starting_floor}...") ... self._motor_direction = None ... self._logic_delegate = logic_delegate ... self._logic_delegate.callbacks = self.Callbacks(self) @@ -71,7 +71,7 @@ The simulation runs in steps. Each time step consists of the elevator moving a s ... ... if delta: ... self._current_floor = self._current_floor + delta - ... print "%s..." % self._current_floor, + ... print(f"{self._current_floor}...") ... self._logic_delegate.on_floor_changed() ... else: ... self._logic_delegate.on_ready() @@ -274,7 +274,7 @@ No amount of legal moves should compel the elevator to enter an illegal state. H >>> import random >>> e = Elevator(ElevatorLogic()) 1... - >>> try: print '-', # doctest:+ELLIPSIS + >>> try: print('-') # doctest:+ELLIPSIS ... finally: ... for i in range(100000): ... r = random.randrange(6) diff --git a/elevator.py b/elevator.py index b44c167..dcb1b43 100644 --- a/elevator.py +++ b/elevator.py @@ -2,7 +2,7 @@ DOWN = 2 FLOOR_COUNT = 6 -class ElevatorLogic(object): +class ElevatorLogic: """ An incorrect implementation. Can you make it pass all the tests?