Ejemplo n.º 1
0
def test_offset():
    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.xoffset() == x0
        assert shoebox.yoffset() == y0
        assert shoebox.zoffset() == z0
        assert shoebox.offset() == (z0, y0, x0)
Ejemplo n.º 2
0
    def tst_offset(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.xoffset() == x0)
            assert (shoebox.yoffset() == y0)
            assert (shoebox.zoffset() == z0)
            assert (shoebox.offset() == (z0, y0, x0))

        # Test passed
        print 'OK'