<s> import unittest <EOL> from mdf . builders . basic import CSVWriter , DataFrameBuilder <EOL> import sys <EOL> if sys . version_info [ <NUM_LIT:0> ] > <NUM_LIT:2> : <EOL> from io import StringIO <EOL> else : <EOL> from cStringIO import StringIO <EOL> class BasicTest ( unittest . TestCase ) : <EOL> nodes = [ <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:3> , <NUM_LIT:4> ] <EOL> labels = [ '<STR_LIT:a>' , '<STR_LIT:b>' , None , '<STR_LIT:d>' ] <EOL> no_lables = [ None ] * <NUM_LIT:4> <EOL> def test_create_csv_writer_with_nodes ( self ) : <EOL> csv_writer = CSVWriter ( StringIO ( ) , [ <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:3> , <NUM_LIT:4> ] ) <EOL> self . assertEqual ( csv_writer . nodes , self . nodes ) <EOL> self . assertEqual ( csv_writer . columns , self . no_lables ) <EOL> def test_create_dataframe_builder_with_nodes ( self ) : <EOL> dframe_builder = DataFrameBuilder ( [ <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:3> , <NUM_LIT:4> ] ) <EOL> self . assertEqual ( dframe_builder . nodes , self . nodes ) <EOL> def test_create_csv_writer_with_node_label_pairs ( self ) : <EOL> csv_writer = CSVWriter ( StringIO ( ) , [ ( <NUM_LIT:1> , '<STR_LIT:a>' ) , [ <NUM_LIT:2> , '<STR_LIT:b>' ] , ( <NUM_LIT:3> , None ) , [ <NUM_LIT:4> , '<STR_LIT:d>' ] ] ) <EOL> self . assertEqual ( csv_writer . nodes , self . nodes ) <EOL> self . assertEqual ( csv_writer . columns , self . labels ) </s>
