def test_normalize_shape(): from gt4py.storage.utils import normalize_shape assert normalize_shape(None) is None assert gt_utils.is_iterable_of(normalize_shape([1, 2, 3]), iterable_class=tuple, item_class=int) # test that exceptions are raised for invalid inputs. try: normalize_shape("1") except TypeError: pass else: assert False try: normalize_shape(1) except TypeError: pass else: assert False try: normalize_shape((0, )) except ValueError: pass else: assert False
def test_normalize_default_origin(): from gt4py.storage.utils import normalize_shape assert normalize_shape(None) is None assert gt_utils.is_iterable_of( gt_storage_utils.normalize_default_origin([1, 2, 3]), iterable_class=gt_ir.Index, item_class=int, ) # test that exceptions are raised for invalid inputs. try: gt_storage_utils.normalize_default_origin("1") except TypeError: pass else: assert False try: gt_storage_utils.normalize_default_origin(1) except TypeError: pass else: assert False try: gt_storage_utils.normalize_default_origin((-1, )) except ValueError: pass else: assert False