mirror of
https://codeberg.org/guix/guix.git
synced 2025-10-02 02:15:12 +00:00
gnu: Add csvkit.
* gnu/packages/wireservice.scm (csvkit): New variable. * gnu/packages/patches/csvkit-fix-tests.patch: New file. * gnu/local.mk (dist_patch_DATA): Add it. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
This commit is contained in:
parent
213b05f04e
commit
bf187d92e3
3 changed files with 119 additions and 0 deletions
45
gnu/packages/patches/csvkit-fix-tests.patch
Normal file
45
gnu/packages/patches/csvkit-fix-tests.patch
Normal file
|
@ -0,0 +1,45 @@
|
|||
diff --git a/tests/test_utilities/test_csvsql.py b/tests/test_utilities/test_csvsql.py
|
||||
index e6ec4af..4f47980 100644
|
||||
--- a/tests/test_utilities/test_csvsql.py
|
||||
+++ b/tests/test_utilities/test_csvsql.py
|
||||
@@ -197,7 +197,7 @@ class TestCSVSQL(CSVKitTestCase, EmptyFileTests):
|
||||
utility.run()
|
||||
output = output_file.getvalue()
|
||||
output_file.close()
|
||||
- self.assertEqual(output, 'a,b,c\n1,2,3\n0,5,6\n')
|
||||
+ self.assertEqual(output, 'a,b,c\n1,2.0,3.0\n0,5.0,6.0\n')
|
||||
|
||||
def test_no_prefix_unique_constraint(self):
|
||||
self.get_output(['--db', 'sqlite:///' + self.db_file, '--insert', 'examples/dummy.csv', '--unique-constraint', 'a'])
|
||||
diff --git a/tests/test_utilities/test_sql2csv.py b/tests/test_utilities/test_sql2csv.py
|
||||
index a0c3d3e..babcfd6 100644
|
||||
--- a/tests/test_utilities/test_sql2csv.py
|
||||
+++ b/tests/test_utilities/test_sql2csv.py
|
||||
@@ -121,23 +121,23 @@ class TestSQL2CSV(CSVKitTestCase, EmptyFileTests):
|
||||
input_file.close()
|
||||
|
||||
def test_unicode(self):
|
||||
- expected = self.csvsql('examples/test_utf8.csv')
|
||||
+ self.csvsql('examples/test_utf8.csv')
|
||||
csv = self.get_output(['--db', 'sqlite:///' + self.db_file, '--query', 'select * from foo'])
|
||||
- self.assertEqual(csv.strip(), expected)
|
||||
+ self.assertEqual(csv.strip(), 'foo,bar,baz\n1.0,2.0,3\n4.0,5.0,ʤ')
|
||||
|
||||
def test_no_header_row(self):
|
||||
self.csvsql('examples/dummy.csv')
|
||||
csv = self.get_output(['--db', 'sqlite:///' + self.db_file, '--no-header-row', '--query', 'select * from foo'])
|
||||
|
||||
self.assertTrue('a,b,c' not in csv)
|
||||
- self.assertTrue('1,2,3' in csv)
|
||||
+ self.assertTrue('1,2.0,3.0' in csv)
|
||||
|
||||
def test_linenumbers(self):
|
||||
self.csvsql('examples/dummy.csv')
|
||||
csv = self.get_output(['--db', 'sqlite:///' + self.db_file, '--linenumbers', '--query', 'select * from foo'])
|
||||
|
||||
self.assertTrue('line_number,a,b,c' in csv)
|
||||
- self.assertTrue('1,1,2,3' in csv)
|
||||
+ self.assertTrue('1,1,2.0,3.0' in csv)
|
||||
|
||||
def test_wildcard_on_sqlite(self):
|
||||
self.csvsql('examples/iris.csv')
|
Loading…
Add table
Add a link
Reference in a new issue