You shouldn’t use string comparison or integer comparison. In the vast majority of cases, it’s preferable to use the dedicated methods on QualityCode - isGood(), isBad(), etc directly:
system.tag.read("TagPath").quality.isGood()
Or, thanks to Jython:
system.tag.read("TagPath").quality.good
If you actually need to check for a specific quality code, then you should use is against a static member of the QualityCode class:
from com.inductiveautomation.ignition.common.model.values import QualityCode
system.tag.read("TagPath").quality.is(QualityCode.Bad_Failure)