File size: 567 Bytes
1600cd6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
"""Input checks carried over from a command line wrapper.

One function opens with a bare assert, which is the shape the explicit raise pattern
rewrites. The other asserts further down, where rewriting it would change what the
function checks first, so the pattern refuses it.
"""


def open_ticket(queue_name):
    assert queue_name, "queue name is required"
    return {"queue": queue_name, "opened": True}


def close_ticket(ticket):
    ticket = dict(ticket)
    ticket["opened"] = False
    assert ticket.get("queue"), "queue name is required"
    return ticket