예제 #1
0
    def test_compare_elements_equal(self):
        # given
        points = [uuid.uuid4(), uuid.uuid4(), uuid.uuid4()],
        element = Element(uid=None,
                          points=points,
                          data=create_data_container())
        reference = Element(uid=None,
                            points=points,
                            data=create_data_container())

        # this should pass without problems
        compare_elements(element, reference, testcase=self)

        # given
        element = Element(uid=None,
                          points=list(reversed(points)),
                          data=create_data_container())

        # this should pass without problems
        compare_elements(element, reference, testcase=self)
예제 #2
0
    def test_compare_elements_equal(self):
        # given
        points = [uuid.uuid4(), uuid.uuid4(), uuid.uuid4()],
        element = Element(
            uid=None,
            points=points,
            data=create_data_container())
        reference = Element(
            uid=None,
            points=points,
            data=create_data_container())

        # this should pass without problems
        compare_elements(element, reference, testcase=self)

        # given
        element = Element(
            uid=None,
            points=list(reversed(points)),
            data=create_data_container())

        # this should pass without problems
        compare_elements(element, reference, testcase=self)
예제 #3
0
    def test_compare_elements_not_equal(self):
        # given
        points = [uuid.uuid4(), uuid.uuid4(), uuid.uuid4()],
        element = Element(
            uid=uuid.uuid4(),
            points=points,
            data=create_data_container())
        reference = Element(
            uid=uuid.uuid4(),
            points=points,
            data=create_data_container())

        # when/then
        with self.assertRaises(AssertionError):
            compare_elements(element, reference, testcase=self)

        # given
        element = Element(
            uid=reference.uid,
            points=points[1:],
            data=create_data_container())

        # when/then
        with self.assertRaises(AssertionError):
            compare_elements(element, reference, testcase=self)

        # given
        element = Element(
            uid=reference.uid,
            points=points,
            data=DataContainer())

        # when/then
        with self.assertRaises(AssertionError):
            compare_elements(element, reference, testcase=self)

        # given
        element = Element(points=[])

        # when/then
        with self.assertRaises(AssertionError):
            compare_elements(element, reference, testcase=self)
예제 #4
0
    def test_compare_elements_not_equal(self):
        # given
        points = [uuid.uuid4(), uuid.uuid4(), uuid.uuid4()],
        element = Element(uid=uuid.uuid4(),
                          points=points,
                          data=create_data_container())
        reference = Element(uid=uuid.uuid4(),
                            points=points,
                            data=create_data_container())

        # when/then
        with self.assertRaises(AssertionError):
            compare_elements(element, reference, testcase=self)

        # given
        element = Element(uid=reference.uid,
                          points=points[1:],
                          data=create_data_container())

        # when/then
        with self.assertRaises(AssertionError):
            compare_elements(element, reference, testcase=self)

        # given
        element = Element(uid=reference.uid,
                          points=points,
                          data=DataContainer())

        # when/then
        with self.assertRaises(AssertionError):
            compare_elements(element, reference, testcase=self)

        # given
        element = Element(points=[])

        # when/then
        with self.assertRaises(AssertionError):
            compare_elements(element, reference, testcase=self)