Esempio n. 1
0
def test_size():
    for i in range(10):
        x0 = random.randint(0, 1000)
        y0 = random.randint(0, 1000)
        z0 = random.randint(0, 1000)
        x1 = random.randint(1, 10) + x0
        y1 = random.randint(1, 10) + y0
        z1 = random.randint(1, 10) + z0

        shoebox = Shoebox((x0, x1, y0, y1, z0, z1))
        assert shoebox.xsize() == x1 - x0
        assert shoebox.ysize() == y1 - y0
        assert shoebox.zsize() == z1 - z0
        assert shoebox.size() == (z1 - z0, y1 - y0, x1 - x0)
Esempio n. 2
0
    def tst_size(self):
        from random import randint
        from dials.model.data import Shoebox

        for i in range(10):

            x0 = randint(0, 1000)
            y0 = randint(0, 1000)
            z0 = randint(0, 1000)
            x1 = randint(1, 10) + x0
            y1 = randint(1, 10) + y0
            z1 = randint(1, 10) + z0

            shoebox = Shoebox((x0, x1, y0, y1, z0, z1))
            assert (shoebox.xsize() == x1 - x0)
            assert (shoebox.ysize() == y1 - y0)
            assert (shoebox.zsize() == z1 - z0)
            assert (shoebox.size() == (z1 - z0, y1 - y0, x1 - x0))

        # Test passed
        print 'OK'