Beispiel #1
0
    def assertNotEquals(self, actual, expected, mesg=None):
        if self.listener is not None:
            self.listener.assertCalled(self.test_case)

        if expected == actual:
            if mesg is None:
                mesg = "Values are equal, but expected not"
            self.test_results.addFailure(
                self.test_case,
                JythonComparisonFailure(mesg, str(expected), str(actual)))
Beispiel #2
0
    def assertLessThan(self, actual, expected, mesg=None):
        if self.listener is not None:
            self.listener.assertCalled(self.test_case)

        if not actual < expected:
            if mesg is None:
                mesg = "Value is more than expected "
            self.test_results.addFailure(
                self.test_case,
                JythonComparisonFailure(mesg, str(expected), str(actual)))
Beispiel #3
0
    def assertEquals(self, actual, expected, mesg=None, delta=None):
        if self.listener is not None:
            self.listener.assertCalled(self.test_case)

        if delta is not None:
            # check if these are both numbers and we have an acceptable buffer window
            # for floating point inaccuracies
            if abs(actual - expected) > delta:
                if mesg is None:
                    mesg = "Values are not equal (within allowed delta)"
                self.test_results.addFailure(
                    self.test_case,
                    JythonComparisonFailure(mesg, str(expected), str(actual)))

        elif expected != actual:
            if mesg is None:
                mesg = "Values are not equal"
            self.test_results.addFailure(
                self.test_case,
                JythonComparisonFailure(mesg, str(expected), str(actual)))
Beispiel #4
0
    def assertNotSame(self, actual, expected, mesg=None):
        if self.listener is not None:
            self.listener.assertCalled(self.test_case)

        if (expected == actual):
            if mesg is None:
                "Expected references to different objects"
            self.test_results.addFailure(
                self.test_case,
                JythonComparisonFailure(
                    "Object references should be different instances",
                    str(expected), str(actual)))
Beispiel #5
0
    def assertNotMatches(self, actual, pattern, mesg=None, flags=None):
        if self.listener is not None:
            self.listener.assertCalled(self.test_case)

        matchval = None
        if flags is not None:
            matchval = re.match(pattern, actual, flags)
        else:
            matchval = re.match(pattern, actual)

        if matchval:
            if mesg is None:
                mesg = "Value matches regex, but shouldn't "
            self.test_results.addFailure(
                self.test_case,
                JythonComparisonFailure(mesg, str(pattern), str(actual)))