function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Phillip MoseleyPhillip Moseley 

Code Coverage Error despite our Code Coverage being 77%

Our code coverage is saying that we're at 77%, but when we try to deploy we're getting a code coverage error back that says we are only at 74% coverage. Why would it give us that we are 77%, but then when we try to deploy we get this error of only 74% coverage?

Thanks for your help in advance!

Phillip

Gaurav NirwalGaurav Nirwal
def two_branches(a, b):
    if a:
        d = 0
    else:
        d = 2
        
    if b:
        x = 2/d
    else:
        x = d/2
        
    return x

# These tests give 100% coverage:
two_branches(False, False) == 1
two_branches(True, False) == 0
two_branches(False, True) == 1

# This test fails with a ZeroDivisionError:
two_branches(True, True)
Phillip MoseleyPhillip Moseley
Sorry, but this below does not mean anything to me. I’m not a developer, so not sure what you are saying.