def test_or_functionality(): q1 = Qualean(random.choice([-1, 0, 1])) q2 = Qualean(random.choice([-1, 0, 1])) if q1.get_number() != 0 or q2.get_number() != 0: assert q1 | q2 == True, "or True case is not working as expected" else: assert q1 | q2 == False, "or False case is not working as expected"
def test_lt(): q1 = Qualean(random.choice([-1, 0, 1])) q2 = Qualean(random.choice([-1, 0, 1])) if q1.get_number() < q2.get_number(): assert (q1 < q2) == True, "__lt__ True case not working" else: assert (q1 < q2) == False, "__lt__ False case not working"
def test_invertsign(): q1 = Qualean(random.choice([-1, 0, 1])) if q1.get_number() < 0: assert (q1.__invertsign__() > 0) == True, "invertsign not working" elif q1.get_number() > 0: assert (q1.__invertsign__() < 0) == True, "invertsign not working" else: assert (q1.__invertsign__() == 0) == True, "invertsign not working"
def test_ge(): q1 = Qualean(random.choice([-1, 0, 1])) q2 = Qualean(random.choice([-1, 0, 1])) if q1.get_number() >= q2.get_number(): # print(q1.get_number()) # print(q2.get_number()) # print(True) assert (q1 >= q2) == True, "__ge__ True case not working" else: # print(q1.get_number()) # print(q2.get_number()) # print(False) assert (q1 >= q2) == False, "__ge__ False case not working"
def test_str(): q = Qualean(0) internal_value = q.get_number() assert q.__str__( ) == f'Qualean: internal number ={internal_value}', 'The print does not meet expectations'