<s> import bayeslite . metamodels . crosscat_generator_schema as cgschema <EOL> def test_parses_a_column ( ) : <EOL> schema = [ [ '<STR_LIT:x>' , '<STR_LIT>' ] , [ ] ] <EOL> parsed = cgschema . parse ( schema , False ) <EOL> expected = cgschema . GeneratorSchema ( <EOL> guess = False , subsample = False , columns = [ ( '<STR_LIT:x>' , '<STR_LIT>' ) ] , <EOL> dep_constraints = [ ] ) <EOL> assert parsed == expected <EOL> def test_parses_dep_constraints ( ) : <EOL> schema = [ <EOL> [ '<STR_LIT:a>' , '<STR_LIT>' ] , [ '<STR_LIT:b>' , '<STR_LIT>' ] , [ '<STR_LIT:c>' , '<STR_LIT>' ] , <EOL> [ '<STR_LIT>' , [ '<STR_LIT:a>' , '<STR_LIT:U+002C>' , '<STR_LIT:b>' ] ] , <EOL> [ '<STR_LIT>' , [ '<STR_LIT:b>' , '<STR_LIT:U+002C>' , '<STR_LIT:c>' ] ] ] <EOL> parsed = cgschema . parse ( schema , False ) <EOL> expected = cgschema . GeneratorSchema ( <EOL> guess = False , subsample = False , <EOL> columns = [ ( '<STR_LIT:a>' , '<STR_LIT>' ) , ( '<STR_LIT:b>' , '<STR_LIT>' ) , ( '<STR_LIT:c>' , '<STR_LIT>' ) ] , <EOL> dep_constraints = [ ( [ '<STR_LIT:a>' , '<STR_LIT:b>' ] , True ) , ( [ '<STR_LIT:b>' , '<STR_LIT:c>' ] , False ) ] ) <EOL> assert parsed == expected <EOL> def test_parses_guess_and_subsample ( ) : <EOL> schema = [ [ '<STR_LIT>' , [ '<STR_LIT:*>' ] ] , [ '<STR_LIT>' , [ <NUM_LIT:5> ] ] ] <EOL> parsed = cgschema . parse ( schema , True ) <EOL> expected = cgschema . GeneratorSchema ( <EOL> guess = True , subsample = <NUM_LIT:5> , columns = [ ] , dep_constraints = [ ] ) <EOL> assert parsed == expected <EOL> def test_parses_subsample_off ( ) : <EOL> schema = [ [ '<STR_LIT>' , [ '<STR_LIT:*>' ] ] , [ '<STR_LIT>' , [ '<STR_LIT>' ] ] ] <EOL> parsed = cgschema . parse ( schema , True ) <EOL> expected = cgschema . GeneratorSchema ( <EOL> guess = True , subsample = False , columns = [ ] , dep_constraints = [ ] ) <EOL> assert parsed == expected </s>
