summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tests/mime-detection/list3
-rw-r--r--tests/mime-detection/test.py219
-rw-r--r--tests/mime-detection/test2.py19
3 files changed, 41 insertions, 0 deletions
diff --git a/tests/mime-detection/list b/tests/mime-detection/list
index 698d96f..114e2df 100644
--- a/tests/mime-detection/list
+++ b/tests/mime-detection/list
@@ -475,6 +475,9 @@ test.py text/x-python
test.pyx text/x-cython ox
# https://gitlab.freedesktop.org/xdg/shared-mime-info/-/issues/127
test_issue127.py text/x-python ox
+# Python 2 script
+test2.py text/x-python2 x
+test.py2 text/x-python2
# Python 3 script
test3.py text/x-python3 x
test.py3 text/x-python3
diff --git a/tests/mime-detection/test.py2 b/tests/mime-detection/test.py2
new file mode 100644
index 0000000..2660a8b
--- /dev/null
+++ b/tests/mime-detection/test.py2
@@ -0,0 +1,19 @@
+#!/usr/bin/python2.7
+
+from math import sin, pi
+
+
+def f(x):
+ return sin(x ** 2)
+
+
+def integrate_f(a, b, N):
+ s = 0
+ dx = (b - a) / N
+ for i in range(N):
+ s += f(a + i * dx)
+ return s * dx
+
+
+if __name__ == '__main__':
+ print integrate_f(0, pi, 1000)
diff --git a/tests/mime-detection/test2.py b/tests/mime-detection/test2.py
new file mode 100644
index 0000000..2660a8b
--- /dev/null
+++ b/tests/mime-detection/test2.py
@@ -0,0 +1,19 @@
+#!/usr/bin/python2.7
+
+from math import sin, pi
+
+
+def f(x):
+ return sin(x ** 2)
+
+
+def integrate_f(a, b, N):
+ s = 0
+ dx = (b - a) / N
+ for i in range(N):
+ s += f(a + i * dx)
+ return s * dx
+
+
+if __name__ == '__main__':
+ print integrate_f(0, pi, 1000)