Example #1
0
    def test_compare_lattice_datasets_equal(self):
        # given
        lattice = make_cubic_lattice('test', 1.0, (2, 3, 4))
        reference = make_cubic_lattice('test', 1.0, (2, 3, 4,))

        data = DataContainer()

        lattice.data = data
        reference.data = data

        # this should pass without problems
        compare_lattice_datasets(lattice, reference, testcase=self)
Example #2
0
    def test_compare_lattice_datasets_not_equal(self):
        # given
        lattice = make_cubic_lattice('test', 1.0, (2, 3, 4))
        reference = make_cubic_lattice('test_ref', 1.0, (
            2,
            3,
            4,
        ))

        data = create_data_container()

        lattice.data = data
        reference.data = data

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

        # given
        test_data = DataContainer()

        lattice = make_cubic_lattice('test_ref', 1.0, (2, 3, 4))
        lattice.data = test_data

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

        # given
        lattice = make_cubic_lattice('test', 2.0, (2, 3, 4))
        lattice.data = data

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

        # given
        lattice = make_cubic_lattice('test_ref', 1.0, (4, 6, 8))
        lattice.data = data

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

        # given
        lattice = make_cubic_lattice('test_ref', 1.0, (2, 3, 4),
                                     (2.0, 2.0, 2.0))
        lattice.data = data

        # when/then
        with self.assertRaises(AssertionError):
            compare_lattice_datasets(lattice, reference, testcase=self)
Example #3
0
    def test_compare_lattice_datasets_not_equal(self):
        # given
        lattice = make_cubic_lattice('test', 1.0, (2, 3, 4))
        reference = make_cubic_lattice('test_ref', 1.0, (2, 3, 4,))

        data = create_data_container()

        lattice.data = data
        reference.data = data

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

        # given
        test_data = DataContainer()

        lattice = make_cubic_lattice('test_ref', 1.0, (2, 3, 4))
        lattice.data = test_data

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

        # given
        lattice = make_cubic_lattice('test', 2.0, (2, 3, 4))
        lattice.data = data

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

        # given
        lattice = make_cubic_lattice('test_ref', 1.0, (4, 6, 8))
        lattice.data = data

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

        # given
        lattice = make_cubic_lattice('test_ref', 1.0, (2, 3, 4),
                                     (2.0, 2.0, 2.0))
        lattice.data = data

        # when/then
        with self.assertRaises(AssertionError):
            compare_lattice_datasets(lattice, reference, testcase=self)
Example #4
0
    def test_compare_lattice_datasets_equal(self):
        # given
        lattice = make_cubic_lattice('test', 1.0, (2, 3, 4))
        reference = make_cubic_lattice('test', 1.0, (
            2,
            3,
            4,
        ))

        data = DataContainer()

        lattice.data = data
        reference.data = data

        # this should pass without problems
        compare_lattice_datasets(lattice, reference, testcase=self)
 def compare_dataset(self, dataset, reference):
     compare_lattice_datasets(dataset, reference, self)