Skip to content

Change the reactor temperature to something smiliar but executable #179

@JensWehner

Description

@JensWehner

For python we replaced the test by this:

# Hint look at monkeypatching for functions
import time
def check_time_to_now_even(seconds):
    """
    Checks whether time difference between now and given time in seconds is even
    """
    if seconds < 0:
        raise ValueError('received negative input')
   
    now=time.time()
    return (seconds-now)%2 == 0

with the solution

#Solution to #4
def test_check_time(monkeypatch):
  def mocktime():
    return 2
  monkeypatch.setattr(time,"time",mocktime)
  assert check_time_to_now_even(0) == 1
  assert check_time_to_now_even(1) == 0

Advantage is people can actually play around with it. The function is quite nonsensical, but we had a better experience with this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions