Changeset: 6cc1594305e5 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=6cc1594305e5
Added Files:
        tools/embeddedpy/Tests/All
        tools/embeddedpy/Tests/pylite00.py
        tools/embeddedpy/Tests/pylite00.stable.err
        tools/embeddedpy/Tests/pylite00.stable.out
        tools/embeddedpy/Tests/pylite01.py
        tools/embeddedpy/Tests/pylite01.stable.err
        tools/embeddedpy/Tests/pylite01.stable.out
        tools/embeddedpy/Tests/pylite02.py
        tools/embeddedpy/Tests/pylite02.stable.err
        tools/embeddedpy/Tests/pylite02.stable.out
        tools/embeddedpy/Tests/pylite03.py
        tools/embeddedpy/Tests/pylite03.stable.err
        tools/embeddedpy/Tests/pylite03.stable.out
        tools/embeddedpy/Tests/pylite04.py
        tools/embeddedpy/Tests/pylite04.stable.err
        tools/embeddedpy/Tests/pylite04.stable.out
Branch: pyapi
Log Message:

Added Mtest.py tests for MonetDBLite/Python (pylite).


diffs (truncated from 306 to 300 lines):

diff --git a/tools/embeddedpy/Tests/All b/tools/embeddedpy/Tests/All
new file mode 100644
--- /dev/null
+++ b/tools/embeddedpy/Tests/All
@@ -0,0 +1,6 @@
+
+HAVE_LIBPY?pylite00
+HAVE_LIBPY?pylite01
+HAVE_LIBPY?pylite02
+HAVE_LIBPY?pylite03
+HAVE_LIBPY?pylite04
diff --git a/tools/embeddedpy/Tests/pylite00.py 
b/tools/embeddedpy/Tests/pylite00.py
new file mode 100644
--- /dev/null
+++ b/tools/embeddedpy/Tests/pylite00.py
@@ -0,0 +1,13 @@
+# Test basic monetdblite.sql statements
+
+import monetdblite, shutil, os
+dbfarm = '/tmp/pylite_dbfarm'
+if os.path.isdir(dbfarm): shutil.rmtree(dbfarm)
+monetdblite.init(dbfarm)
+
+monetdblite.sql('CREATE TABLE pylite00 (i INTEGER)')
+monetdblite.sql('INSERT INTO pylite00 VALUES (1), (2), (3), (4), (5)')
+print monetdblite.sql('SELECT * FROM pylite00')
+
+shutil.rmtree(dbfarm)
+
diff --git a/tools/embeddedpy/Tests/pylite00.stable.err 
b/tools/embeddedpy/Tests/pylite00.stable.err
new file mode 100644
--- /dev/null
+++ b/tools/embeddedpy/Tests/pylite00.stable.err
@@ -0,0 +1,12 @@
+stderr of test 'pylite00` in directory 'tools/embeddedpy` itself:
+
+
+# 14:17:04 >  
+# 14:17:04 >  "/usr/bin/python2" "pylite00.py" "pylite00"
+# 14:17:04 >  
+
+
+# 14:17:05 >  
+# 14:17:05 >  "Done."
+# 14:17:05 >  
+
diff --git a/tools/embeddedpy/Tests/pylite00.stable.out 
b/tools/embeddedpy/Tests/pylite00.stable.out
new file mode 100644
--- /dev/null
+++ b/tools/embeddedpy/Tests/pylite00.stable.out
@@ -0,0 +1,16 @@
+stdout of test 'pylite00` in directory 'tools/embeddedpy` itself:
+
+
+# 14:17:04 >  
+# 14:17:04 >  "/usr/bin/python2" "pylite00.py" "pylite00"
+# 14:17:04 >  
+
+Making directory /tmp/pylite_dbfarm
+# Start processing logs sql/sql_logs version 52200
+# Finished processing logs sql/sql_logs
+{'i': array([1, 2, 3, 4, 5], dtype=int32)}
+
+# 14:17:05 >  
+# 14:17:05 >  "Done."
+# 14:17:05 >  
+
diff --git a/tools/embeddedpy/Tests/pylite01.py 
b/tools/embeddedpy/Tests/pylite01.py
new file mode 100644
--- /dev/null
+++ b/tools/embeddedpy/Tests/pylite01.py
@@ -0,0 +1,15 @@
+# Test monetdblite.create statement
+
+import monetdblite, shutil, os
+dbfarm = '/tmp/pylite_dbfarm'
+if os.path.isdir(dbfarm): shutil.rmtree(dbfarm)
+monetdblite.init(dbfarm)
+
+import numpy
+monetdblite.create('pylite01', ['i'], numpy.arange(100000))
+res = monetdblite.sql('select * from pylite01')
+print res
+print 'Count', len(res['i'])
+
+shutil.rmtree(dbfarm)
+
diff --git a/tools/embeddedpy/Tests/pylite01.stable.err 
b/tools/embeddedpy/Tests/pylite01.stable.err
new file mode 100644
--- /dev/null
+++ b/tools/embeddedpy/Tests/pylite01.stable.err
@@ -0,0 +1,12 @@
+stderr of test 'pylite01` in directory 'tools/embeddedpy` itself:
+
+
+# 14:17:05 >  
+# 14:17:05 >  "/usr/bin/python2" "pylite01.py" "pylite01"
+# 14:17:05 >  
+
+
+# 14:17:05 >  
+# 14:17:05 >  "Done."
+# 14:17:05 >  
+
diff --git a/tools/embeddedpy/Tests/pylite01.stable.out 
b/tools/embeddedpy/Tests/pylite01.stable.out
new file mode 100644
--- /dev/null
+++ b/tools/embeddedpy/Tests/pylite01.stable.out
@@ -0,0 +1,17 @@
+stdout of test 'pylite01` in directory 'tools/embeddedpy` itself:
+
+
+# 14:17:05 >  
+# 14:17:05 >  "/usr/bin/python2" "pylite01.py" "pylite01"
+# 14:17:05 >  
+
+Making directory /tmp/pylite_dbfarm
+# Start processing logs sql/sql_logs version 52200
+# Finished processing logs sql/sql_logs
+{'i': array([    0,     1,     2, ..., 99997, 99998, 99999])}
+Count 100000
+
+# 14:17:05 >  
+# 14:17:05 >  "Done."
+# 14:17:05 >  
+
diff --git a/tools/embeddedpy/Tests/pylite02.py 
b/tools/embeddedpy/Tests/pylite02.py
new file mode 100644
--- /dev/null
+++ b/tools/embeddedpy/Tests/pylite02.py
@@ -0,0 +1,16 @@
+# Test monetdblite.insert statement
+
+import monetdblite, shutil, os
+dbfarm = '/tmp/pylite_dbfarm'
+if os.path.isdir(dbfarm): shutil.rmtree(dbfarm)
+monetdblite.init(dbfarm)
+
+import numpy
+monetdblite.create('pylite02', ['i'], numpy.arange(100000))
+monetdblite.insert('pylite02', numpy.arange(100000))
+res = monetdblite.sql('select * from pylite02')
+print res
+print 'Count', len(res['i'])
+
+shutil.rmtree(dbfarm)
+
diff --git a/tools/embeddedpy/Tests/pylite02.stable.err 
b/tools/embeddedpy/Tests/pylite02.stable.err
new file mode 100644
--- /dev/null
+++ b/tools/embeddedpy/Tests/pylite02.stable.err
@@ -0,0 +1,12 @@
+stderr of test 'pylite02` in directory 'tools/embeddedpy` itself:
+
+
+# 14:17:05 >  
+# 14:17:05 >  "/usr/bin/python2" "pylite02.py" "pylite02"
+# 14:17:05 >  
+
+
+# 14:17:06 >  
+# 14:17:06 >  "Done."
+# 14:17:06 >  
+
diff --git a/tools/embeddedpy/Tests/pylite02.stable.out 
b/tools/embeddedpy/Tests/pylite02.stable.out
new file mode 100644
--- /dev/null
+++ b/tools/embeddedpy/Tests/pylite02.stable.out
@@ -0,0 +1,17 @@
+stdout of test 'pylite02` in directory 'tools/embeddedpy` itself:
+
+
+# 14:17:05 >  
+# 14:17:05 >  "/usr/bin/python2" "pylite02.py" "pylite02"
+# 14:17:05 >  
+
+Making directory /tmp/pylite_dbfarm
+# Start processing logs sql/sql_logs version 52200
+# Finished processing logs sql/sql_logs
+{'i': array([    0,     1,     2, ..., 99997, 99998, 99999])}
+Count 200000
+
+# 14:17:06 >  
+# 14:17:06 >  "Done."
+# 14:17:06 >  
+
diff --git a/tools/embeddedpy/Tests/pylite03.py 
b/tools/embeddedpy/Tests/pylite03.py
new file mode 100644
--- /dev/null
+++ b/tools/embeddedpy/Tests/pylite03.py
@@ -0,0 +1,15 @@
+# monetdblite.create statement with multiple columns
+
+import monetdblite, shutil, os
+dbfarm = '/tmp/pylite_dbfarm'
+if os.path.isdir(dbfarm): shutil.rmtree(dbfarm)
+monetdblite.init(dbfarm)
+
+import numpy
+monetdblite.create('pylite03', ['i', 'j', 'k', 'l', 'm'], 
numpy.arange(100000).reshape((5,20000)))
+res = monetdblite.sql('select * from pylite03')
+print res
+print 'Count', len(res['i'])
+
+shutil.rmtree(dbfarm)
+
diff --git a/tools/embeddedpy/Tests/pylite03.stable.err 
b/tools/embeddedpy/Tests/pylite03.stable.err
new file mode 100644
--- /dev/null
+++ b/tools/embeddedpy/Tests/pylite03.stable.err
@@ -0,0 +1,12 @@
+stderr of test 'pylite03` in directory 'tools/embeddedpy` itself:
+
+
+# 14:17:06 >  
+# 14:17:06 >  "/usr/bin/python2" "pylite03.py" "pylite03"
+# 14:17:06 >  
+
+
+# 14:17:07 >  
+# 14:17:07 >  "Done."
+# 14:17:07 >  
+
diff --git a/tools/embeddedpy/Tests/pylite03.stable.out 
b/tools/embeddedpy/Tests/pylite03.stable.out
new file mode 100644
--- /dev/null
+++ b/tools/embeddedpy/Tests/pylite03.stable.out
@@ -0,0 +1,17 @@
+stdout of test 'pylite03` in directory 'tools/embeddedpy` itself:
+
+
+# 14:17:06 >  
+# 14:17:06 >  "/usr/bin/python2" "pylite03.py" "pylite03"
+# 14:17:06 >  
+
+Making directory /tmp/pylite_dbfarm
+# Start processing logs sql/sql_logs version 52200
+# Finished processing logs sql/sql_logs
+{'i': array([    0,     1,     2, ..., 19997, 19998, 19999]), 'k': 
array([40000, 40001, 40002, ..., 59997, 59998, 59999]), 'j': array([20000, 
20001, 20002, ..., 39997, 39998, 39999]), 'm': array([80000, 80001, 80002, ..., 
99997, 99998, 99999]), 'l': array([60000, 60001, 60002, ..., 79997, 79998, 
79999])}
+Count 20000
+
+# 14:17:07 >  
+# 14:17:07 >  "Done."
+# 14:17:07 >  
+
diff --git a/tools/embeddedpy/Tests/pylite04.py 
b/tools/embeddedpy/Tests/pylite04.py
new file mode 100644
--- /dev/null
+++ b/tools/embeddedpy/Tests/pylite04.py
@@ -0,0 +1,17 @@
+# Test SQL types in monetdblite
+
+import monetdblite, shutil, os
+dbfarm = '/tmp/pylite_dbfarm'
+if os.path.isdir(dbfarm): shutil.rmtree(dbfarm)
+monetdblite.init(dbfarm)
+
+import numpy
+monetdblite.sql('CREATE TABLE pylite04_decimal(d DECIMAL(18,3))')
+monetdblite.insert('pylite04_decimal', numpy.arange(100000))
+print monetdblite.sql('SELECT * FROM 
pylite04_decimal')['d'].astype(numpy.int32)
+
+monetdblite.sql('CREATE TABLE pylite04_date(d DATE)')
+monetdblite.insert('pylite04_date', ['2000-01-01'])
+print monetdblite.sql('SELECT * FROM pylite04_date')['d']
+
+
diff --git a/tools/embeddedpy/Tests/pylite04.stable.err 
b/tools/embeddedpy/Tests/pylite04.stable.err
new file mode 100644
--- /dev/null
+++ b/tools/embeddedpy/Tests/pylite04.stable.err
@@ -0,0 +1,12 @@
+stderr of test 'pylite04` in directory 'tools/embeddedpy` itself:
+
+
+# 14:17:07 >  
+# 14:17:07 >  "/usr/bin/python2" "pylite04.py" "pylite04"
+# 14:17:07 >  
+
+
+# 14:17:07 >  
+# 14:17:07 >  "Done."
+# 14:17:07 >  
+
diff --git a/tools/embeddedpy/Tests/pylite04.stable.out 
b/tools/embeddedpy/Tests/pylite04.stable.out
new file mode 100644
--- /dev/null
+++ b/tools/embeddedpy/Tests/pylite04.stable.out
@@ -0,0 +1,17 @@
+stdout of test 'pylite04` in directory 'tools/embeddedpy` itself:
+
+
+# 14:17:07 >  
+# 14:17:07 >  "/usr/bin/python2" "pylite04.py" "pylite04"
+# 14:17:07 >  
+
+Making directory /tmp/pylite_dbfarm
+# Start processing logs sql/sql_logs version 52200
+# Finished processing logs sql/sql_logs
+[    0     1     2 ..., 99997 99998 99999]
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to