Permalink
Browse files

Fix unit tests; add sample csv

  • Loading branch information...
saulpw committed Sep 7, 2017
1 parent e30dbe6 commit db9aff58bdcd0677d85c62bf10ff1ebcb7277d27
View
@@ -1,4 +1,3 @@
*.?sv
__pycache__
.tox/
.idea/
View
@@ -3,7 +3,8 @@
# Usage $0
for i in tests/*.vd ; do
echo "--- $i"
PYTHONPATH=. bin/vd --confirm-overwrite=False --play $i -- --output=${i%.vd}.tsv
done
git --no-pager diff tests/
git --no-pager diff --exit-code --numstat tests/
@@ -0,0 +1,91 @@
"Index", "Year", "Age", "Name", "Movie"
1, 1928, 22, "Janet Gaynor", "Seventh Heaven, Street Angel and Sunrise: A Song of Two Humans"
2, 1929, 37, "Mary Pickford", "Coquette"
3, 1930, 28, "Norma Shearer", "The Divorcee"
4, 1931, 63, "Marie Dressler", "Min and Bill"
5, 1932, 32, "Helen Hayes", "The Sin of Madelon Claudet"
6, 1933, 26, "Katharine Hepburn", "Morning Glory"
7, 1934, 31, "Claudette Colbert", "It Happened One Night"
8, 1935, 27, "Bette Davis", "Dangerous"
9, 1936, 27, "Luise Rainer", "The Great Ziegfeld"
10, 1937, 28, "Luise Rainer", "The Good Earth"
11, 1938, 30, "Bette Davis", "Jezebel"
12, 1939, 26, "Vivien Leigh", "Gone with the Wind"
13, 1940, 29, "Ginger Rogers", "Kitty Foyle"
14, 1941, 24, "Joan Fontaine", "Suspicion"
15, 1942, 38, "Greer Garson", "Mrs. Miniver"
16, 1943, 25, "Jennifer Jones", "The Song of Bernadette"
17, 1944, 29, "Ingrid Bergman", "Gaslight"
18, 1945, 40, "Joan Crawford", "Mildred Pierce"
19, 1946, 30, "Olivia de Havilland", "To Each His Own"
20, 1947, 35, "Loretta Young", "The Farmer's Daughter"
21, 1948, 32, "Jane Wyman", "Johnny Belinda"
22, 1949, 33, "Olivia de Havilland", "The Heiress"
23, 1950, 29, "Judy Holliday", "Born Yesterday"
24, 1951, 38, "Vivien Leigh", "A Streetcar Named Desire"
25, 1952, 54, "Shirley Booth", "Come Back, Little Sheba"
26, 1953, 24, "Audrey Hepburn", "Roman Holiday"
27, 1954, 25, "Grace Kelly", "The Country Girl"
28, 1955, 48, "Anna Magnani", "The Rose Tattoo"
29, 1956, 41, "Ingrid Bergman", "Anastasia"
30, 1957, 28, "Joanne Woodward", "The Three Faces of Eve"
31, 1958, 41, "Susan Hayward", "I Want to Live!"
32, 1959, 39, "Simone Signoret", "Room at the Top"
33, 1960, 29, "Elizabeth Taylor", "BUtterfield 8"
34, 1961, 27, "Sophia Loren", "Two Women"
35, 1962, 31, "Anne Bancroft", "The Miracle Worker"
36, 1963, 31, "Patricia Neal", "Hud"
37, 1964, 29, "Julie Andrews", "Mary Poppins"
38, 1965, 25, "Julie Christie", "Darling"
39, 1966, 35, "Elizabeth Taylor", "Who's Afraid of Virginia Woolf?"
40, 1967, 60, "Katharine Hepburn", "Guess Who's Coming to Dinner"
41, 1968, 61, "Katharine Hepburn", "The Lion in Winter"
42, 1969, 26, "Barbra Streisand", "Funny Girl"
43, 1970, 35, "Maggie Smith", "The Prime of Miss Jean Brodie"
44, 1971, 34, "Glenda Jackson", "Women in Love"
45, 1972, 34, "Jane Fonda", "Klute"
46, 1973, 27, "Liza Minnelli", "Cabaret"
47, 1974, 37, "Glenda Jackson", "A Touch of Class"
48, 1975, 42, "Ellen Burstyn", "Alice Doesn't Live Here Anymore"
49, 1976, 41, "Louise Fletcher", "One Flew Over the Cuckoo's Nest"
50, 1977, 36, "Faye Dunaway", "Network"
51, 1978, 32, "Diane Keaton", "Annie Hall"
52, 1979, 41, "Jane Fonda", "Coming Home"
53, 1980, 33, "Sally Field", "Norma Rae"
54, 1981, 31, "Sissy Spacek", "Coal Miner's Daughter"
55, 1982, 74, "Katharine Hepburn", "On Golden Pond"
56, 1983, 33, "Meryl Streep", "Sophie's Choice"
57, 1984, 49, "Shirley MacLaine", "Terms of Endearment"
58, 1985, 38, "Sally Field", "Places in the Heart"
59, 1986, 61, "Geraldine Page", "The Trip to Bountiful"
60, 1987, 21, "Marlee Matlin", "Children of a Lesser God"
61, 1988, 41, "Cher", "Moonstruck"
62, 1989, 26, "Jodie Foster", "The Accused"
63, 1990, 80, "Jessica Tandy", "Driving Miss Daisy"
64, 1991, 42, "Kathy Bates", "Misery"
65, 1992, 29, "Jodie Foster", "The Silence of the Lambs"
66, 1993, 33, "Emma Thompson", "Howards End"
67, 1994, 36, "Holly Hunter", "The Piano"
68, 1995, 45, "Jessica Lange", "Blue Sky"
69, 1996, 49, "Susan Sarandon", "Dead Man Walking"
70, 1997, 39, "Frances McDormand", "Fargo"
71, 1998, 34, "Helen Hunt", "As Good as It Gets"
72, 1999, 26, "Gwyneth Paltrow", "Shakespeare in Love"
73, 2000, 25, "Hilary Swank", "Boys Don't Cry"
74, 2001, 33, "Julia Roberts", "Erin Brockovich"
75, 2002, 35, "Halle Berry", "Monster's Ball"
76, 2003, 35, "Nicole Kidman", "The Hours"
77, 2004, 28, "Charlize Theron", "Monster"
78, 2005, 30, "Hilary Swank", "Million Dollar Baby"
79, 2006, 29, "Reese Witherspoon", "Walk the Line"
80, 2007, 61, "Helen Mirren", "The Queen"
81, 2008, 32, "Marion Cotillard", "La Vie en rose"
82, 2009, 33, "Kate Winslet", "The Reader"
83, 2010, 45, "Sandra Bullock", "The Blind Side"
84, 2011, 29, "Natalie Portman", "Black Swan"
85, 2012, 62, "Meryl Streep", "The Iron Lady"
86, 2013, 22, "Jennifer Lawrence", "Silver Linings Playbook"
87, 2014, 44, "Cate Blanchett", "Blue Jasmine"
88, 2015, 54, "Julianne Moore", "Still Alice"
89, 2016, 26, "Brie Larson", "Room"
@@ -8,12 +8,6 @@ sample $ sample set column type to currency
sample + sum sample choose aggregator for this column
sample c o sample go to visible column by regex of name
sample F sample_OrderDate_freq open frequency table from values in this column
sample_OrderDate_freq C sample_OrderDate_freq_columns open Columns for this sheet
sample_OrderDate_freq_columns j sample_OrderDate_freq_columns go one row down
sample_OrderDate_freq_columns s sample_OrderDate_freq_columns select this row
sample_OrderDate_freq_columns s sample_OrderDate_freq_columns select this row
sample_OrderDate_freq_columns g- sample_OrderDate_freq_columns hide all selected columns on source sheet
sample_OrderDate_freq_columns q sample_OrderDate_freq quit the current sheet
sample_OrderDate_freq [ sample_OrderDate_freq sort by this column ascending
sample_OrderDate_freq l sample_OrderDate_freq go one column right
sample_OrderDate_freq ^ Revenue sample_OrderDate_freq rename this column
View
@@ -1,4 +1,4 @@
Item num percent histogram
Item count percent histogram
Binder 13 35.14 **************************************************************************
Pencil 12 32.43 ********************************************************************
Pen Set 7 18.92 ****************************************
View
@@ -1,55 +1,91 @@
Family MaxAbund AvgAbund Mass Diet Passerine Aquatic
Hawks&Eagles&Kites 2.985543693 0.674021641 716.0189356 Vertebrate 0 0
Long-tailed tits 37.8 4.04043 5.3 Insect 1 0
Larks 241.4 23.1054 35.77708764 PlantInsect 1 0
Kingfishers 4.4 0.594906 119.3717162 Vertebrate 0 0
Auks& Puffins 4.532504791 2.963271765 315.4955185 InsectVert 0 1
Ducks& Geese 23.69363524 2.741672852 1144.290035 PlantInsect 0 1
Anhingas 24.6 1.84231 1250 Vertebrate 0 1
Swifts 43.9739995 3.952014068 27.39269818 Insect 0 0
Limpkins 1.6 0.566667 1100 Insect 0 1
Herons& Egrets 46.4597129 2.970944624 462.3001048 Vertebrate 0 1
Waxwings 11.66533326 2.795903253 42.33202098 PlantInsect 1 0
Nightjars 9.09756124 1.572129619 57.84491153 Insect 0 0
Cardinals& Buntings& Grosbreaks 49.84475012 6.615462 24.04748225 PlantInsect 1 0
Creepers 9.6 1.02512 8.4 Insect 1 0
Plovers 5.089107341 1.681270643 89.02073172 Insect 0 1
Storks 20 2.9 2400 Insect 0 1
Pigeons & Doves 14.87611003 3.0448496 140.5755382 Plant 0 0
Cuckoos 4.437120042 1.314525714 95.21462173 Insect 0 0
Sparrows & Buntings 35.42740517 6.794523609 21.67675181 PlantInsect 1 0
Falcons 2.058283778 0.569004864 473.6826732 Vertebrate 0 0
Frigate birds 0.2 0.2 1500 Vertebrate 0 1
Finches 41.42846364 4.926521391 21.80729294 Plant 1 0
Loons 4.757966318 1.193624729 3190.160779 Vertebrate 0 1
Swallows 157.8806094 10.45898683 19.21668948 Insect 0 0
Blackbirds & Orioles 100.7571886 10.32062124 53.71384673 PlantInsect 1 0
Shrikes 2.315167381 0.70321405 55.85696018 InsectVert 1 0
Mockingbirds & Thrashers 17.5018567 3.182322363 60.52103281 PlantInsect 1 0
Wagtails & Pipits 15.87654996 3.417479183 19.80405458 Insect 1 0
Chickadees 28.72889712 6.360897296 12.17863603 PlantInsect 1 0
Wood warblers 31.58989848 3.69869263 10.67837379 Insect 1 0
OW Sparrows 122.5332608 8.580340902 24.81934729 PlantInsect 1 0
Pelecans 255.6478828 20.68249096 5296.225071 Vertebrate 0 1
Olive Warbler 2.6 1.35 11 Insect 1 0
Cromorants 33.9263876 7.659101449 1940.778029 Vertebrate 0 1
Grouse& Pheasant 6.341572253 1.336282109 841.2222371 PlantInsect 0 0
Woodpeckers 12.65242034 2.363520863 66.6807482 PlantInsect 0 0
Silky-flycatchers 38.4 5.34737 24 PlantInsect 1 0
Rails 6.828902645 1.297514552 153.7589531 Insect 0 1
Kinglets 65.03845017 5.799750209 6.244997998 Insect 1 0
Sandpipers 7.800654629 1.862600981 89.80402619 Insect 0 1
Nuthatches 30.43393702 2.97971133 12.18574676 PlantInsect 1 0
Owls 0.773934576 0.330332835 221.8373953 Vertebrate 0 0
Starlings 413.6 47.5976 119.1209108 PlantInsect 1 0
Gannets&Boobies 61.4 31.8 1512.987943 Vertebrate 0 1
Gnatcatchers 100.9778166 12.08757638 6.365522799 Insect 1 0
Tanagers 31.10834113 4.121437584 29.3177632 PlantInsect 1 0
Ibises 71.95386514 9.032337908 835.7064623 Insect 0 1
Babblers 42.4 7.975 14 PlantInsect 0 0
Wrens 53.98624257 5.949881887 13.39754676 Insect 1 0
Trogons 0.2 0.2 70 Insect 0 0
Thrushes 25.11485055 4.672446701 41.59792338 PlantInsect 1 0
Flycatchers 20.38193317 3.843142516 20.34911751 Insect 1 0
Owls 1.2 0.385714 460 Vertebrate 0 0
Vireos 25.03338835 3.572727361 13.60808768 PlantInsect 1 0
Index Year Age Name Movie
1 1928 22 Janet Gaynor Seventh Heaven, Street Angel and Sunrise: A Song of Two Humans
2 1929 37 Mary Pickford Coquette
3 1930 28 Norma Shearer The Divorcee·
4 1931 63 Marie Dressler Min and Bill
5 1932 32 Helen Hayes The Sin of Madelon Claudet·
6 1933 26 Katharine Hepburn Morning Glory
7 1934 31 Claudette Colbert It Happened One Night
8 1935 27 Bette Davis Dangerous
9 1936 27 Luise Rainer The Great Ziegfeld
10 1937 28 Luise Rainer The Good Earth
11 1938 30 Bette Davis Jezebel
12 1939 26 Vivien Leigh Gone with the Wind
13 1940 29 Ginger Rogers Kitty Foyle
14 1941 24 Joan Fontaine Suspicion·
15 1942 38 Greer Garson Mrs. Miniver
16 1943 25 Jennifer Jones The Song of Bernadette
17 1944 29 Ingrid Bergman Gaslight
18 1945 40 Joan Crawford Mildred Pierce
19 1946 30 Olivia de Havilland To Each His Own
20 1947 35 Loretta Young The Farmer's Daughter
21 1948 32 Jane Wyman Johnny Belinda
22 1949 33 Olivia de Havilland The Heiress
23 1950 29 Judy Holliday Born Yesterday
24 1951 38 Vivien Leigh A Streetcar Named Desire
25 1952 54 Shirley Booth Come Back, Little Sheba
26 1953 24 Audrey Hepburn Roman Holiday
27 1954 25 Grace Kelly The Country Girl
28 1955 48 Anna Magnani The Rose Tattoo
29 1956 41 Ingrid Bergman Anastasia
30 1957 28 Joanne Woodward The Three Faces of Eve
31 1958 41 Susan Hayward I Want to Live!
32 1959 39 Simone Signoret Room at the Top
33 1960 29 Elizabeth Taylor BUtterfield 8
34 1961 27 Sophia Loren Two Women
35 1962 31 Anne Bancroft The Miracle Worker
36 1963 31 Patricia Neal Hud
37 1964 29 Julie Andrews Mary Poppins
38 1965 25 Julie Christie Darling
39 1966 35 Elizabeth Taylor Who's Afraid of Virginia Woolf?
40 1967 60 Katharine Hepburn Guess Who's Coming to Dinner
41 1968 61 Katharine Hepburn The Lion in Winter
42 1969 26 Barbra Streisand Funny Girl
43 1970 35 Maggie Smith The Prime of Miss Jean Brodie
44 1971 34 Glenda Jackson Women in Love
45 1972 34 Jane Fonda Klute
46 1973 27 Liza Minnelli Cabaret
47 1974 37 Glenda Jackson A Touch of Class
48 1975 42 Ellen Burstyn Alice Doesn't Live Here Anymore·
49 1976 41 Louise Fletcher One Flew Over the Cuckoo's Nest
50 1977 36 Faye Dunaway Network
51 1978 32 Diane Keaton Annie Hall
52 1979 41 Jane Fonda Coming Home
53 1980 33 Sally Field Norma Rae
54 1981 31 Sissy Spacek Coal Miner's Daughter·
55 1982 74 Katharine Hepburn On Golden Pond
56 1983 33 Meryl Streep Sophie's Choice
57 1984 49 Shirley MacLaine Terms of Endearment·
58 1985 38 Sally Field Places in the Heart
59 1986 61 Geraldine Page The Trip to Bountiful·
60 1987 21 Marlee Matlin Children of a Lesser God
61 1988 41 Cher Moonstruck
62 1989 26 Jodie Foster The Accused
63 1990 80 Jessica Tandy Driving Miss Daisy
64 1991 42 Kathy Bates Misery
65 1992 29 Jodie Foster The Silence of the Lambs
66 1993 33 Emma Thompson Howards End
67 1994 36 Holly Hunter The Piano
68 1995 45 Jessica Lange Blue Sky
69 1996 49 Susan Sarandon Dead Man Walking
70 1997 39 Frances McDormand Fargo
71 1998 34 Helen Hunt As Good as It Gets
72 1999 26 Gwyneth Paltrow Shakespeare in Love
73 2000 25 Hilary Swank Boys Don't Cry
74 2001 33 Julia Roberts Erin Brockovich
75 2002 35 Halle Berry Monster's Ball
76 2003 35 Nicole Kidman The Hours
77 2004 28 Charlize Theron Monster
78 2005 30 Hilary Swank Million Dollar Baby
79 2006 29 Reese Witherspoon Walk the Line
80 2007 61 Helen Mirren The Queen
81 2008 32 Marion Cotillard La Vie en rose
82 2009 33 Kate Winslet The Reader
83 2010 45 Sandra Bullock The Blind Side
84 2011 29 Natalie Portman Black Swan
85 2012 62 Meryl Streep The Iron Lady
86 2013 22 Jennifer Lawrence Silver Linings Playbook
87 2014 44 Cate Blanchett Blue Jasmine
88 2015 54 Julianne Moore Still Alice
89 2016 26 Brie Larson Room
¿ ¿ ¿ ¿ ¿
View
@@ -1,3 +1,3 @@
start_sheet keystrokes input end_sheet comment
o sample_data/birdsdiet.csv birdsdiet open file
birdsdiet ^S tests/03-loadcsv.tsv birdsdiet save this sheet to new file
o sample_data/oscar_age_female.csv birdsdiet open file
birdsdiet ^S tests/load-csv.tsv birdsdiet save this sheet to new file
@@ -128,7 +128,10 @@ def reload(self):
assert ntallied == len(self.source.rows), (ntallied, len(self.source.rows))
else:
for r in self.genProgress(self.source.rows):
v = str(self.origCol.getValue(r))
try:
v = self.origCol.getValue(r)
except Exception as e:
v = 'error: %s' %e
histrow = rowidx.get(v)
if histrow is None:
histrow = (v, [])
View
@@ -5,6 +5,7 @@
option('csv_dialect', 'excel', 'dialect passed to csv.reader')
option('csv_delimiter', ',', 'delimiter passed to csv.reader')
option('csv_quotechar', '"', 'quotechar passed to csv.reader')
option('csv_skipinitialspace', True, 'skipinitialspace passed to csv.reader')
def open_csv(p):
@@ -28,7 +29,8 @@ def load_csv(vs):
rdr = csv.reader(fp,
dialect=options.csv_dialect,
quotechar=options.csv_quotechar,
delimiter=options.csv_delimiter)
delimiter=options.csv_delimiter,
skipinitialspace=options.csv_skipinitialspace)
vs.rows = []
View
@@ -1420,8 +1420,8 @@ def name(self):
def clean_to_id(s): # [Nas Banov] https://stackoverflow.com/a/3305731
return re.sub(r'\W|^(?=\d)', '_', str(s))
if not self._id:
self._id = clean_to_id(self._name) or defaultColNames[self.sheet.columns.index(self)]
return self._name or self._id
self._id = clean_to_id(self._name) or self.sheet and defaultColNames[self.sheet.columns.index(self)]
return self._name or self._id or ''
@name.setter
def name(self, name):

0 comments on commit db9aff5

Please sign in to comment.