Oct-14-2020, 08:01 AM
class A:
def __init__(self, a):
self.a = a
def __eq__(self, other):
return True
def aptx(a):
return A(a)
Sorry I don't know how to keep the indentation. I didn't think of this bug myself, a friend did. Basically my school only uses "assert func(a) == b" as test cases, and no one checks the code manually at all. As a result code in above format can pass all cases no matter what, without doing any real job.
If there's anyone who works at an educational institution here, please be careful with the possible exploitation of your testing method (never underestimate people, even first years) and at least carry out spot checks manually on students' code.
def __init__(self, a):
self.a = a
def __eq__(self, other):
return True
def aptx(a):
return A(a)
Sorry I don't know how to keep the indentation. I didn't think of this bug myself, a friend did. Basically my school only uses "assert func(a) == b" as test cases, and no one checks the code manually at all. As a result code in above format can pass all cases no matter what, without doing any real job.
If there's anyone who works at an educational institution here, please be careful with the possible exploitation of your testing method (never underestimate people, even first years) and at least carry out spot checks manually on students' code.