<s> from __future__ import absolute_import , division , print_function <EOL> import pytest <EOL> from odo . numpy_dtype import dshape_to_pandas , unit_to_dtype , dshape_to_numpy <EOL> from datashape import dshape <EOL> import numpy as np <EOL> @ pytest . mark . parametrize ( <EOL> [ '<STR_LIT>' , '<STR_LIT>' ] , <EOL> [ <EOL> ( '<STR_LIT>' , np . float64 ) , <EOL> ( '<STR_LIT>' , np . int32 ) , <EOL> ( '<STR_LIT>' , np . float32 ) , <EOL> ] <EOL> ) <EOL> def test_decimal ( ds , expected ) : <EOL> assert unit_to_dtype ( dshape ( ds ) ) == expected <EOL> @ pytest . mark . parametrize ( <EOL> [ '<STR_LIT>' , '<STR_LIT>' ] , <EOL> [ ( '<STR_LIT>' , '<STR_LIT>' ) , <EOL> ( '<STR_LIT>' , '<STR_LIT>' ) ] <EOL> ) <EOL> def test_parameterized_option_instances ( ds , field ) : <EOL> dtypes , _ = dshape_to_pandas ( dshape ( ds ) ) <EOL> assert isinstance ( dtypes [ field ] , np . dtype ) <EOL> @ pytest . mark . parametrize ( <EOL> '<STR_LIT>' , <EOL> [ <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' <EOL> ] <EOL> ) <EOL> def test_unit_to_dtype ( ds ) : <EOL> assert isinstance ( unit_to_dtype ( ds ) , np . dtype ) <EOL> @ pytest . mark . parametrize ( <EOL> [ '<STR_LIT>' , '<STR_LIT>' ] , <EOL> [ <EOL> ( '<STR_LIT>' , ( { '<STR_LIT:a>' : np . dtype ( '<STR_LIT>' ) } , [ ] ) ) , <EOL> ( '<STR_LIT>' , ( { '<STR_LIT:a>' : np . dtype ( '<STR_LIT>' ) } , [ '<STR_LIT>' ] ) ) , <EOL> ( '<STR_LIT>' , ( { '<STR_LIT:a>' : np . dtype ( '<STR_LIT>' ) } , [ ] ) ) <EOL> ] <EOL> ) <EOL> def test_dshape_to_pandas ( ds , expected ) : <EOL> assert dshape_to_pandas ( ds ) == expected <EOL> @ pytest . mark . parametrize ( <EOL> [ '<STR_LIT>' , '<STR_LIT>' ] , <EOL> [ <EOL> ( '<STR_LIT>' , '<STR_LIT>' ) , <EOL> ( '<STR_LIT>' , '<STR_LIT>' ) , <EOL> ( <EOL> '<STR_LIT>' , <EOL> [ ( '<STR_LIT:name>' , '<STR_LIT>' ) , ( '<STR_LIT>' , '<STR_LIT>' ) ] <EOL> ) , <EOL> ( '<STR_LIT>' , [ ( '<STR_LIT>' , '<STR_LIT>' ) , ( '<STR_LIT>' , '<STR_LIT>' ) ] ) <EOL> ] <EOL> ) <EOL> def test_dshape_to_numpy ( ds , dt ) : <EOL> assert dshape_to_numpy ( ds ) == np . dtype ( dt ) </s>
