[Scipy-svn] r4100 - in trunk/scipy/io/arff/tests: . data

scipy-svn@scip... scipy-svn@scip...
Mon Apr 7 15:44:15 CDT 2008


Author: cdavid
Date: 2008-04-07 15:44:11 -0500 (Mon, 07 Apr 2008)
New Revision: 4100

Added:
   trunk/scipy/io/arff/tests/data/test5.arff
Modified:
   trunk/scipy/io/arff/tests/data/test4.arff
   trunk/scipy/io/arff/tests/test_data.py
Log:
Test arff files with comments in the data section.

Modified: trunk/scipy/io/arff/tests/data/test4.arff
===================================================================
--- trunk/scipy/io/arff/tests/data/test4.arff	2008-04-07 19:37:33 UTC (rev 4099)
+++ trunk/scipy/io/arff/tests/data/test4.arff	2008-04-07 20:44:11 UTC (rev 4100)
@@ -1,4 +1,4 @@
-@RELATION test4
+@RELATION test5
 
 @ATTRIBUTE attr0	REAL
 @ATTRIBUTE attr1 	REAL
@@ -8,5 +8,7 @@
 
 @DATA
 0.1, 0.2, 0.3, 0.4,class1
+% laksjdhf
 -0.1, -0.2, -0.3, -0.4,class2
+% lsdflkjhaksjdhf
 1, 2, 3, 4,class3

Added: trunk/scipy/io/arff/tests/data/test5.arff
===================================================================
--- trunk/scipy/io/arff/tests/data/test5.arff	2008-04-07 19:37:33 UTC (rev 4099)
+++ trunk/scipy/io/arff/tests/data/test5.arff	2008-04-07 20:44:11 UTC (rev 4100)
@@ -0,0 +1,12 @@
+@RELATION test4
+
+@ATTRIBUTE attr0	REAL
+@ATTRIBUTE attr1 	REAL
+@ATTRIBUTE attr2 	REAL
+@ATTRIBUTE attr3	REAL
+@ATTRIBUTE class 	{class0, class1, class2, class3}
+
+@DATA
+0.1, 0.2, 0.3, 0.4,class1
+-0.1, -0.2, -0.3, -0.4,class2
+1, 2, 3, 4,class3

Modified: trunk/scipy/io/arff/tests/test_data.py
===================================================================
--- trunk/scipy/io/arff/tests/test_data.py	2008-04-07 19:37:33 UTC (rev 4099)
+++ trunk/scipy/io/arff/tests/test_data.py	2008-04-07 20:44:11 UTC (rev 4100)
@@ -9,6 +9,7 @@
 data_path = os.path.join(os.path.dirname(__file__), 'data')
 
 test4 = os.path.join(data_path, 'test4.arff')
+test5 = os.path.join(data_path, 'test5.arff')
 expect4_data = [(0.1, 0.2, 0.3, 0.4, 'class1'), 
         (-0.1, -0.2, -0.3, -0.4, 'class2'), 
         (1, 2, 3, 4, 'class3')]
@@ -17,7 +18,14 @@
 class DataTest(TestCase):
     def test1(self):
         """Parsing trivial file with nothing."""
-        data, meta = read_arff(test4)
+        self._test(test4)
+
+    def test2(self):
+        """Parsing trivial file with some comments in the data section."""
+        self._test(test5)
+
+    def _test(self, test_file):
+        data, meta = read_arff(test_file)
         for i in range(len(data)):
             for j in range(4):
                 assert_array_almost_equal(expect4_data[i][j], data[i][j])



More information about the Scipy-svn mailing list