Exemplo n.º 1
0
 def test_tuple(self):
     observed = _quokka_normalize_extract((1, 1, 644, 642))
     assert isinstance(observed, ia.BoundingBox)
     assert observed.x1 == 1
     assert observed.y1 == 1
     assert observed.x2 == 644
     assert observed.y2 == 642
Exemplo n.º 2
0
 def test_string_square(self):
     observed = _quokka_normalize_extract("square")
     assert isinstance(observed, ia.BoundingBox)
     assert observed.x1 == 0
     assert observed.y1 == 0
     assert observed.x2 == 643
     assert observed.y2 == 643
Exemplo n.º 3
0
 def test_wrong_input_type(self):
     got_exception = False
     try:
         _ = _quokka_normalize_extract(False)
     except Exception as exc:
         assert "Expected 'square' or tuple" in str(exc)
         got_exception = True
     assert got_exception
Exemplo n.º 4
0
 def test_boundingbox(self):
     observed = _quokka_normalize_extract(
         ia.BoundingBox(x1=1, y1=1, x2=644, y2=642))
     assert isinstance(observed, ia.BoundingBox)
     assert observed.x1 == 1
     assert observed.y1 == 1
     assert observed.x2 == 644
     assert observed.y2 == 642
Exemplo n.º 5
0
 def test_boundingboxesonimage(self):
     observed = _quokka_normalize_extract(
         ia.BoundingBoxesOnImage(
             [ia.BoundingBox(x1=1, y1=1, x2=644, y2=642)],
             shape=(643, 960, 3)))
     assert isinstance(observed, ia.BoundingBox)
     assert observed.x1 == 1
     assert observed.y1 == 1
     assert observed.x2 == 644
     assert observed.y2 == 642