Skip to content

Commit

Permalink
add test data
Browse files Browse the repository at this point in the history
  • Loading branch information
rvyhnal committed Oct 7, 2024
1 parent 772308b commit e73a9b5
Show file tree
Hide file tree
Showing 23 changed files with 144 additions and 1 deletion.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@
/config.ini
/tests/**
!/tests/*
!/tests/test_data/*
/tests/statistics.txt
convey.log
output_*
*@example*
*@example*
.venv
4 changes: 4 additions & 0 deletions tests/test_data/bare_template.eml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Subject: Testing e-mail

Just a bare template.
Keen regards
Binary file added tests/test_data/black.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 16 additions & 0 deletions tests/test_data/combined_list_method.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
foo,red,second.example.com,foo-2,[email protected],female
foo,red,second.example.com,foo-1,[email protected],male
foo,red,second.example.com,foo-2,[email protected],female
foo,red,second.example.com,foo-1,[email protected],male
foo,green,first.example.com,foo-2,[email protected],female
foo,green,first.example.com,foo-1,[email protected],male
foo,green,first.example.com,foo-2,[email protected],female
foo,green,first.example.com,foo-1,[email protected],male
bar,blue,wikipedia.org,bar-2,[email protected],male
bar,blue,wikipedia.org,bar-1,[email protected],male
bar,yellow,example.com,bar-2,[email protected],male
bar,yellow,example.com,bar-1,[email protected],male
foo,orange,wikipedia.com,foo-2,[email protected],female
foo,orange,wikipedia.com,foo-1,[email protected],male
foo,orange,wikipedia.com,foo-2,[email protected],female
foo,orange,wikipedia.com,foo-1,[email protected],male
8 changes: 8 additions & 0 deletions tests/test_data/combined_sheet_person.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
foo,red,second.example.com,[email protected],female
foo,red,second.example.com,[email protected],male
foo,green,first.example.com,[email protected],female
foo,green,first.example.com,[email protected],male
bar,blue,wikipedia.org,[email protected],male
bar,yellow,example.com,[email protected],male
foo,orange,wikipedia.com,[email protected],female
foo,orange,wikipedia.com,[email protected],male
6 changes: 6 additions & 0 deletions tests/test_data/consumption.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
category,price,consumption
bulb,100,30
bulb,150,10
kettle,250,70
kettle,352,80
bulb,120,15
9 changes: 9 additions & 0 deletions tests/test_data/email_template.eml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Subject: My cool dynamic template demonstrating a {% if amount() %}long{% else %}short{% endif %} amount of lines!

Here we demonstrate jinja templating.
We send you {% if amount() %}lots of colours: {{ joined(1) }}{% else %}single colour: {{ first_row[1] }}{% endif %}.

{% if amount() %}
Here is the complete list of the multirow file.
{{ attachment() }}
{% endif %}
33 changes: 33 additions & 0 deletions tests/test_data/external_pick_base.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import dateutil

from convey import PickInput
from convey import PickMethod

def dumb_method(val):
""" This is a dumb testing method """
return f"-{val}-"

def list_method(arg):
""" This external type returns a list. The lines should be duplicated. """
return [arg + "-1", arg + "-2"]


@PickInput
def time_format(val, format_="%H:%M"):
""" This text will be displayed to the user.
If running in headless mode, the default format will be "%H:%M" (hours:minutes). """
return dateutil.parser.parse(val).strftime(format_)


@PickMethod("all")
class PickMethodTest(PickMethod):
@staticmethod
def all(x):
""" All of them. """
return x

@classmethod
def filtered(cls, x):
""" Filter some of them """
if x in ["a", "b", "c"]:
return x
8 changes: 8 additions & 0 deletions tests/test_data/gif.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[email protected],black.gif
[email protected],white.gif
[email protected],white.gif
[email protected],black.gif
[email protected],red-permission.gif
[email protected],black.gif
[email protected],white.gif

4 changes: 4 additions & 0 deletions tests/test_data/person.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[email protected],foo,male
[email protected],foo,female
[email protected],bar,male

Binary file added tests/test_data/person.ods
Binary file not shown.
Binary file added tests/test_data/person.xls
Binary file not shown.
Binary file added tests/test_data/person.xlsx
Binary file not shown.
5 changes: 5 additions & 0 deletions tests/test_data/person_gif.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[email protected],foo,male,black.gif
[email protected],foo,female,white.gif
[email protected],bar,male,black.gif
[email protected],bar,male,red-permission.gif
[email protected],bar,male,white.gif
3 changes: 3 additions & 0 deletions tests/test_data/person_header.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
e-mail,random column,gender
[email protected],foo,male
[email protected],foo,female
Binary file added tests/test_data/red-permission.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions tests/test_data/sheet.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
foo,red,second.example.com
foo,green,first.example.com
bar,blue,wikipedia.org
bar,yellow,example.com
foo,orange,wikipedia.com
10 changes: 10 additions & 0 deletions tests/test_data/sheet_duplicated.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
foo,red,second.example.com,foo-2
foo,red,second.example.com,foo-1
foo,green,first.example.com,foo-2
foo,green,first.example.com,foo-1
bar,blue,wikipedia.org,bar-2
bar,blue,wikipedia.org,bar-1
bar,yellow,example.com,bar-2
bar,yellow,example.com,bar-1
foo,orange,wikipedia.com,foo-2
foo,orange,wikipedia.com,foo-1
6 changes: 6 additions & 0 deletions tests/test_data/sheet_header.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
word;colour;host;colour2
foo;red;second.example.com;blue
foo;green;first.example.com;blue
bar;blue;wikipedia.org;yellow
bar;yellow;example.com;
foo;orange;wikipedia.com;
7 changes: 7 additions & 0 deletions tests/test_data/sheet_header_itself.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
word,colour,host,colour2,word,colour,host
foo,red,second.example.com,blue,,,
foo,green,first.example.com,blue,,,
bar,blue,wikipedia.org,yellow,foo,green,first.example.com
bar,blue,wikipedia.org,yellow,foo,red,second.example.com
bar,yellow,example.com,,bar,blue,wikipedia.org
foo,orange,wikipedia.com,,,,
9 changes: 9 additions & 0 deletions tests/test_data/sheet_header_person.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
word,colour,host,colour2,[email protected],male
foo,red,second.example.com,blue,[email protected],female
foo,red,second.example.com,blue,[email protected],male
foo,green,first.example.com,blue,[email protected],female
foo,green,first.example.com,blue,[email protected],male
bar,blue,wikipedia.org,yellow,[email protected],male
bar,yellow,example.com,,[email protected],male
foo,orange,wikipedia.com,,[email protected],female
foo,orange,wikipedia.com,,[email protected],male
8 changes: 8 additions & 0 deletions tests/test_data/sheet_person.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
foo,red,second.example.com,[email protected],female
foo,red,second.example.com,[email protected],male
foo,green,first.example.com,[email protected],female
foo,green,first.example.com,[email protected],male
bar,blue,wikipedia.org,,
bar,yellow,example.com,,
foo,orange,wikipedia.com,[email protected],female
foo,orange,wikipedia.com,[email protected],male
Binary file added tests/test_data/white.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit e73a9b5

Please sign in to comment.