Skip to content

Commit

Permalink
[tests-] update unit tests to use packaged sample.tsv + benchmark.csv #…
Browse files Browse the repository at this point in the history
  • Loading branch information
anjakefala committed Jan 4, 2024
1 parent 1c829d2 commit b34b2e1
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ include visidata/man/visidata.1
include visidata/ddw/input.ddw
include visidata/ddw/regex.ddw
include visidata/tests/sample.tsv
include visidata/tests/benchmark.csv
include visidata/desktop/visidata.desktop
include visidata/experimental/noahs_tapestry/*.json
include visidata/experimental/noahs_tapestry/*.md
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
package_data={
"visidata.man": ["vd.1", "vd.txt"],
"visidata.ddw": ["input.ddw", "regex.ddw"],
"visidata.tests": ["sample.tsv"],
"visidata.tests": ["sample.tsv", "benchmark.csv"],
"visidata.desktop": ["visidata.desktop"],
"visidata.experimenta.noahs_tapestry": [
"clues.json",
Expand Down
12 changes: 7 additions & 5 deletions visidata/features/slide.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ def moveVisibleCol(sheet, fromVisColIdx, toVisColIdx):

## tests

sample_path = vd.pkg_resources_files(visidata) / 'tests/sample.tsv'
benchmark_path = vd.pkg_resources_files(visidata) / 'tests/benchmark.csv'

def make_tester(setup_vdx):
def t(vdx, golden):
Expand All @@ -114,8 +116,8 @@ def t(vdx, golden):
return t

def test_slide_keycol_1(vd):
t = make_tester('''
open-file sample_data/sample.tsv
t = make_tester(f'''
open-file {sample_path}
+::OrderDate key-col
+::Region key-col
+::Rep key-col
Expand All @@ -139,12 +141,12 @@ def test_slide_keycol_1(vd):


def test_slide_leftmost(vd):
t = make_tester('''open-file sample_data/benchmark.csv''')
t = make_tester(f'''open-file {benchmark_path}''')

t('+::Paid slide-leftmost', 'Paid Date Customer SKU Item Quantity Unit')

t = make_tester('''
open-file sample_data/benchmark.csv
t = make_tester(f'''
open-file {benchmark_path}
+::Date key-col
''')

Expand Down

0 comments on commit b34b2e1

Please sign in to comment.