88import numpy
99import pytest
1010
11- from diffpy .utils .parsers . data_loader import load_data
11+ from diffpy .utils .parsers import loadData
1212
1313
1414##############################################################################
@@ -18,41 +18,41 @@ def prepare_fixture(self, datafile):
1818 self .datafile = datafile
1919
2020 def test_loadData_default (self ):
21- """check load_data () with default options"""
21+ """check loadData () with default options"""
2222 loaddata01 = self .datafile ("loaddata01.txt" )
2323 d2c = numpy .array ([[3 , 31 ], [4 , 32 ], [5 , 33 ]])
24- self .assertRaises (IOError , load_data , "doesnotexist" )
24+ self .assertRaises (IOError , loadData , "doesnotexist" )
2525 # the default minrows=10 makes it read from the third line
26- d = load_data (loaddata01 )
26+ d = loadData (loaddata01 )
2727 self .assertTrue (numpy .array_equal (d2c , d ))
2828 # the usecols=(0, 1) would make it read from the third line
29- d = load_data (loaddata01 , minrows = 1 , usecols = (0 , 1 ))
29+ d = loadData (loaddata01 , minrows = 1 , usecols = (0 , 1 ))
3030 self .assertTrue (numpy .array_equal (d2c , d ))
3131 # check the effect of usecols effect
32- d = load_data (loaddata01 , usecols = (0 ,))
32+ d = loadData (loaddata01 , usecols = (0 ,))
3333 self .assertTrue (numpy .array_equal (d2c [:, 0 ], d ))
34- d = load_data (loaddata01 , usecols = (1 ,))
34+ d = loadData (loaddata01 , usecols = (1 ,))
3535 self .assertTrue (numpy .array_equal (d2c [:, 1 ], d ))
3636 return
3737
3838 def test_loadData_1column (self ):
3939 """check loading of one-column data."""
4040 loaddata01 = self .datafile ("loaddata01.txt" )
4141 d1c = numpy .arange (1 , 6 )
42- d = load_data (loaddata01 , usecols = [0 ], minrows = 1 )
42+ d = loadData (loaddata01 , usecols = [0 ], minrows = 1 )
4343 self .assertTrue (numpy .array_equal (d1c , d ))
44- d = load_data (loaddata01 , usecols = [0 ], minrows = 2 )
44+ d = loadData (loaddata01 , usecols = [0 ], minrows = 2 )
4545 self .assertTrue (numpy .array_equal (d1c , d ))
46- d = load_data (loaddata01 , usecols = [0 ], minrows = 3 )
46+ d = loadData (loaddata01 , usecols = [0 ], minrows = 3 )
4747 self .assertFalse (numpy .array_equal (d1c , d ))
4848 return
4949
5050 def test_loadData_headers (self ):
51- """check load_data () with headers options enabled"""
51+ """check loadData () with headers options enabled"""
5252 loaddatawithheaders = self .datafile ("loaddatawithheaders.txt" )
5353 hignore = ["# " , "// " , "[" ] # ignore lines beginning with these strings
5454 delimiter = ": " # what our data should be separated by
55- hdata = load_data (loaddatawithheaders , headers = True , hdel = delimiter , hignore = hignore )
55+ hdata = loadData (loaddatawithheaders , headers = True , hdel = delimiter , hignore = hignore )
5656 # only fourteen lines of data are formatted properly
5757 assert len (hdata ) == 14
5858 # check the following are floats
0 commit comments