def setUp(self): self.tab = tabulate.Table() self.rain = ''' Monday Week Mon Tue Wed Thu Fri Sat Sun Total Description ------------------------------------------------------------------------ 2019-12-30 1 0.0 0.2 0.0 0.0 1.2 0.0 0.0 1.4 Dry 2020-01-06 2 0.5 0.0 0.0 6.4 0.0 0.1 1.7 8.7 Damp 2020-01-13 3 5.3 1.7 9.1 3.0 1.7 0.0 0.0 20.8 Wet 2020-01-20 4 0.0 0.0 0.0 0.0 0.0 0.1 2.3 2.4 Dry 2020-01-27 5 8.4 2.1 0.0 0.5 1.0 0.0 7.1 19.1 Wet 2020-02-03 6 0.1 0.0 0.0 0.0 0.0 1.5 10.6 12.2 Humid 2020-02-10 7 5.5 0.0 0.5 6.6 0.0 4.9 15.6 33.1 Monsoon 2020-02-17 8 0.2 3.3 1.0 3.8 0.0 0.5 1.0 9.8 Damp 2020-02-24 9 6.1 0.5 0.1 8.6 5.9 7.1 0.2 28.5 Monsoon '''.strip() self.diary = ''' Monday 0.38 0.52 Tuesday 0.41 0.14 Wednesday 0.91 0.17 Thursday 0.22 0.94 Friday 0.94 0.28 Saturday 0.62 0.02 Sunday 0.34 0.25 '''.strip()
def setUp(self): self.tab = tabulate.Table() self.rain = [ "Monday Week Mon Tue Wed Thu Fri Sat Sun Total".split(), ['--'], "2020-01-13 3 5.3 1.7 9.1 3.0 1.7 0.0 0.0 20.8".split(), "2020-01-27 5 8.4 2.1 0.0 0.5 1.0 0.0 7.1 19.1".split(), "2020-02-03 6 0.1 0.0 0.0 0.0 0.0 1.5 10.6 12.2".split(), "2020-02-10 7 5.5 0.0 0.5 6.6 0.0 4.9 15.6 33.1".split(), [], "2020-02-24 9 6.1 0.5 0.1 8.6 5.9 7.1 0.2 28.5".split(), "2020-03-02 10 0.0 0.0 4.3 0.0 3.0 12.4 0.0 19.7".split(), "2020-03-09 11 0.0 4.3 6.3 1.3 1.0 1.0 0.0 13.9".split(), "2020-03-30 14 0.1 0.1 10.9 0.0 0.0 0.0 0.0 11.1".split() ] self.tab.parse_lol(self.rain) self.expected = ''' Monday Week Mon Tue Wed Thu Fri Sat Sun Total ------------------------------------------------------------- 2020-01-13 3 5.3 1.7 9.1 3.0 1.7 0.0 0.0 20.8 2020-01-27 5 8.4 2.1 0.0 0.5 1.0 0.0 7.1 19.1 2020-02-03 6 0.1 0.0 0.0 0.0 0.0 1.5 10.6 12.2 2020-02-10 7 5.5 0.0 0.5 6.6 0.0 4.9 15.6 33.1 2020-02-24 9 6.1 0.5 0.1 8.6 5.9 7.1 0.2 28.5 2020-03-02 10 0.0 0.0 4.3 0.0 3.0 12.4 0.0 19.7 2020-03-09 11 0.0 4.3 6.3 1.3 1.0 1.0 0.0 13.9 2020-03-30 14 0.1 0.1 10.9 0.0 0.0 0.0 0.0 11.1 '''.strip()
def setUp(self): self.tab = tabulate.Table() self.simple = ''' 30.2 135 4.5 29.5 132 4.5 28.8 136 4.7 29.3 155 5.0 27.8 208 6.3 18.1 1375 48.6 23.0 1428 50.5 '''.strip()
def setUp(self): self.tab = tabulate.Table() self.help = ''' Try one of these: add arr ditto dp dup filter gen group help label levels make noblanks nospace pivot pop push roll rule sf shuffle sort tap uniq unwrap unzip wrap xp zip '''.strip() self.verbs = ''' Functions for arr: abs all any base bool chr cos cosd date divmod dow epoch exp format hex hms hr hypot int len log log10 max min mins oct ord pi pow randomd reversed round secs sin sind sorted sqrt sum tan tand tau time '''.strip()
def test_copy_data(self): "copy and create new table" self.bat = tabulate.Table() self.bat.parse_lol(self.tab.copy()) self.assertTrue(self.bat) self.assertEqual(len(self.bat), 9) self.assertEqual(self.bat.cols, 10) self.assertEqual(self.bat[-1], self.rain[-1]) # extras are not copied... self.bat.add_rule(1) self.bat.add_blank(5) self.assertEqual(str(self.bat), self.expected)
def setUp(self): self.tab = tabulate.Table() self.rain = ''' Month Monday Mon Tue Wed Thu Fri Sat Sun Total ---------------------------------------------------------------------- December 2019 2019-12-30 0.0 0.2 0.0 0.0 1.2 0.0 0.0 1.4 January 2020 2020-01-06 0.5 0.0 0.0 6.4 0.0 0.1 1.7 8.7 January 2020 2020-01-13 5.3 1.7 9.1 3.0 1.7 0.0 0.0 20.8 January 2020 2020-01-20 0.0 0.0 0.0 0.0 0.0 0.1 2.3 2.4 January 2020 2020-01-27 8.4 2.1 0.0 0.5 1.0 0.0 7.1 19.1 February 2020 2020-02-03 0.1 0.0 0.0 0.0 0.0 1.5 10.6 12.2 February 2020 2020-02-10 5.5 0.0 0.5 6.6 0.0 4.9 15.6 33.1 February 2020 2020-02-17 0.2 3.3 1.0 3.8 0.0 0.5 1.0 9.8 February 2020 2020-02-24 6.1 0.5 0.1 8.6 5.9 7.1 0.2 28.5 March 2020 2020-03-02 0.0 0.0 4.3 0.0 3.0 12.4 0.0 19.7 March 2020 2020-03-09 0.0 4.3 6.3 1.3 1.0 1.0 0.0 13.9 March 2020 2020-03-16 3.6 1.3 0.0 0.0 0.0 0.5 0.0 5.4 March 2020 2020-03-23 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 March 2020 2020-03-30 0.1 0.1 10.9 0.0 0.0 0.0 0.0 11.1 '''.strip() self.grouped = ''' Month Monday Mon Tue Wed Thu Fri Sat Sun Total ---------------------------------------------------------------------- December 2019 2019-12-30 0.0 0.2 0.0 0.0 1.2 0.0 0.0 1.4 January 2020 2020-01-06 0.5 0.0 0.0 6.4 0.0 0.1 1.7 8.7 January 2020 2020-01-13 5.3 1.7 9.1 3.0 1.7 0.0 0.0 20.8 January 2020 2020-01-20 0.0 0.0 0.0 0.0 0.0 0.1 2.3 2.4 January 2020 2020-01-27 8.4 2.1 0.0 0.5 1.0 0.0 7.1 19.1 February 2020 2020-02-03 0.1 0.0 0.0 0.0 0.0 1.5 10.6 12.2 February 2020 2020-02-10 5.5 0.0 0.5 6.6 0.0 4.9 15.6 33.1 February 2020 2020-02-17 0.2 3.3 1.0 3.8 0.0 0.5 1.0 9.8 February 2020 2020-02-24 6.1 0.5 0.1 8.6 5.9 7.1 0.2 28.5 March 2020 2020-03-02 0.0 0.0 4.3 0.0 3.0 12.4 0.0 19.7 March 2020 2020-03-09 0.0 4.3 6.3 1.3 1.0 1.0 0.0 13.9 March 2020 2020-03-16 3.6 1.3 0.0 0.0 0.0 0.5 0.0 5.4 March 2020 2020-03-23 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 March 2020 2020-03-30 0.1 0.1 10.9 0.0 0.0 0.0 0.0 11.1 '''.strip()
def setUp(self): self.tab = tabulate.Table() self.rain = ''' Monday Week Mon Tue Wed Thu Fri Sat Sun Total ------------------------------------------------------------- 2019-12-30 1 0.0 0.2 0.0 0.0 1.2 0.0 0.0 1.4 2020-01-06 2 0.5 0.0 0.0 6.4 0.0 0.1 1.7 8.7 2020-01-13 3 5.3 1.7 9.1 3.0 1.7 0.0 0.0 20.8 2020-01-20 4 0.0 0.0 0.0 0.0 0.0 0.1 2.3 2.4 2020-01-27 5 8.4 2.1 0.0 0.5 1.0 0.0 7.1 19.1 2020-02-03 6 0.1 0.0 0.0 0.0 0.0 1.5 10.6 12.2 2020-02-10 7 5.5 0.0 0.5 6.6 0.0 4.9 15.6 33.1 2020-02-17 8 0.2 3.3 1.0 3.8 0.0 0.5 1.0 9.8 2020-02-24 9 6.1 0.5 0.1 8.6 5.9 7.1 0.2 28.5 2020-03-02 10 0.0 0.0 4.3 0.0 3.0 12.4 0.0 19.7 2020-03-09 11 0.0 4.3 6.3 1.3 1.0 1.0 0.0 13.9 2020-03-16 12 3.6 1.3 0.0 0.0 0.0 0.5 0.0 5.4 2020-03-23 13 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 2020-03-30 14 0.1 0.1 10.9 0.0 0.0 0.0 0.0 11.1 '''.strip()
def setUp(self): self.tab = tabulate.Table() self.covid = ''' Country Region Deaths Death rate Total Cases -------------------------------------------------------- Argentina America 51965 117 2107365 Belgium Europe 22077 192 771511 Brazil America 254942 122 10551259 Canada America 21990 59 871694 Chile America 20572 110 824625 Colombia America 59766 120 2251690 Czech Republic Europe 20339 191 1235480 Ecuador America 15811 92 286155 France Europe 85582 132 3686813 Germany Europe 70152 84 2450306 Hungary Europe 14974 154 428599 India Asia 157157 12 11112241 Indonesia Asia 36166 14 1334634 Iran Asia 60073 73 1631169 Italy Europe 97699 161 2925265 Mexico America 185715 147 2086938 Netherlands Europe 15566 91 1088886 Peru America 46494 145 1329805 Poland Europe 43769 115 1706986 Portugal Europe 16317 159 804562 Romania Europe 20350 104 801994 Russia Asia 84700 58 4198400 South Africa Africa 49993 86 1513393 Spain Europe 69142 148 3188553 Turkey Asia 28569 35 2701588 UK Europe 122849 183 4176554 Ukraine Europe 27472 62 1399813 US Europe 510900 156 28494973 '''.strip() self.levels = ''' # Country: All distinct. # Region: Europe 14, America 8, Asia 5, Africa 1 # Death rate: Min: 12 Q25: 75.75 Median: 116 Mean: 111.5 Q75: 152.5 Max: 192 '''.strip()
def setUp(self): self.tab = tabulate.Table()
def setUp(self): self.tab = tabulate.Table() self.rain = ''' Monday Week Mon Tue Wed Thu Fri Sat Sun Total ------------------------------------------------------------ 2019-12-30 1 0.0 0.2 0.0 0.0 1.2 0.0 0.0 1.4 2020-01-06 2 0.5 0.0 0.0 6.4 0.0 0.1 1.7 8.7 2020-01-13 3 5.3 1.7 9.1 3.0 1.7 0.0 0.0 20.8 2020-01-20 4 0.0 0.0 0.0 0.0 0.0 0.1 2.3 2.4 2020-01-27 5 8.4 2.1 0.0 0.5 1.0 0.0 7.1 19.1 2020-02-03 6 0.1 0.0 0.0 0.0 0.0 1.5 10.6 12.2 2020-02-10 7 5.5 0.0 0.5 6.6 0.0 4.9 15.6 33.1 2020-02-17 8 0.2 3.3 1.0 3.8 0.0 0.5 1.0 9.8 2020-02-24 9 6.1 0.5 0.1 8.6 5.9 7.1 0.2 28.5 2020-03-02 10 0.0 0.0 4.3 0.0 3.0 12.4 0.0 19.7 '''.strip() self.rain_summary = ''' Monday Week Mon Tue Wed Thu Fri Sat Sun Total ------------------------------------------------------------ 2019-12-30 1 0.0 0.2 0.0 0.0 1.2 0.0 0.0 1.4 2020-01-06 2 0.5 0.0 0.0 6.4 0.0 0.1 1.7 8.7 2020-01-13 3 5.3 1.7 9.1 3.0 1.7 0.0 0.0 20.8 2020-01-20 4 0.0 0.0 0.0 0.0 0.0 0.1 2.3 2.4 2020-01-27 5 8.4 2.1 0.0 0.5 1.0 0.0 7.1 19.1 2020-02-03 6 0.1 0.0 0.0 0.0 0.0 1.5 10.6 12.2 2020-02-10 7 5.5 0.0 0.5 6.6 0.0 4.9 15.6 33.1 2020-02-17 8 0.2 3.3 1.0 3.8 0.0 0.5 1.0 9.8 2020-02-24 9 6.1 0.5 0.1 8.6 5.9 7.1 0.2 28.5 2020-03-02 10 0.0 0.0 4.3 0.0 3.0 12.4 0.0 19.7 ------------------------------------------------------------ Min 1 0.0 0.0 0.0 0.0 0.0 0.0 0.0 1.4 Q25 2 0.0 0.0 0.0 0.0 0.0 0.0 0.0 2.4 Median 4 0.2 0.0 0.0 0.2 0.0 0.1 0.6 11.0 Mean 5 2.0 0.6 1.2 2.2 1.0 2.1 3.0 13.1 Q75 7 5.4 0.9 1.0 4.4 1.3 2.8 4.0 20.0 Max 10 8.4 3.3 9.1 8.6 5.9 12.4 15.6 33.1 '''.strip() self.total_rain = ''' Monday Week Mon Tue Wed Thu Fri Sat Sun Total ---------------------------------------------------------------- 2019-12-30 1 0.0 0.2 0.0 0.0 1.2 0.0 0.0 1.4 2020-01-06 2 0.5 0.0 0.0 6.4 0.0 0.1 1.7 8.7 2020-01-13 3 5.3 1.7 9.1 3.0 1.7 0.0 0.0 20.8 2020-01-20 4 0.0 0.0 0.0 0.0 0.0 0.1 2.3 2.4 2020-01-27 5 8.4 2.1 0.0 0.5 1.0 0.0 7.1 19.1 2020-02-03 6 0.1 0.0 0.0 0.0 0.0 1.5 10.6 12.2 2020-02-10 7 5.5 0.0 0.5 6.6 0.0 4.9 15.6 33.1 2020-02-17 8 0.2 3.3 1.0 3.8 0.0 0.5 1.0 9.8 2020-02-24 9 6.1 0.5 0.1 8.6 5.9 7.1 0.2 28.5 2020-03-02 10 0.0 0.0 4.3 0.0 3.0 12.4 0.0 19.7 ---------------------------------------------------------------- Total 55 26.1 7.8 15.0 28.9 12.8 26.6 38.5 155.7 '''.strip() self.mean_rain = ''' Monday Week Mon Tue Wed Thu Fri Sat Sun Total ---------------------------------------------------------------- 2019-12-30 1 0.0 0.2 0.0 0.0 1.2 0.0 0.0 1.4 2020-01-06 2 0.5 0.0 0.0 6.4 0.0 0.1 1.7 8.7 2020-01-13 3 5.3 1.7 9.1 3.0 1.7 0.0 0.0 20.8 2020-01-20 4 0.0 0.0 0.0 0.0 0.0 0.1 2.3 2.4 2020-01-27 5 8.4 2.1 0.0 0.5 1.0 0.0 7.1 19.1 2020-02-03 6 0.1 0.0 0.0 0.0 0.0 1.5 10.6 12.2 2020-02-10 7 5.5 0.0 0.5 6.6 0.0 4.9 15.6 33.1 2020-02-17 8 0.2 3.3 1.0 3.8 0.0 0.5 1.0 9.8 2020-02-24 9 6.1 0.5 0.1 8.6 5.9 7.1 0.2 28.5 2020-03-02 10 0.0 0.0 4.3 0.0 3.0 12.4 0.0 19.7 ---------------------------------------------------------------- Mean 5.5 2.61 0.78 1.5 2.89 1.28 2.66 3.85 15.57 '''.strip() self.prod_rain = ''' Monday Week Mon Tue Wed Thu Fri Sat Sun Total ----------------------------------------------------------------------------------- 2019-12-30 1 0.0 0.2 0.0 0.0 1.2 0.0 0.0 1.4 2020-01-06 2 0.5 0.0 0.0 6.4 0.0 0.1 1.7 8.7 2020-01-13 3 5.3 1.7 9.1 3.0 1.7 0.0 0.0 20.8 2020-01-20 4 0.0 0.0 0.0 0.0 0.0 0.1 2.3 2.4 2020-01-27 5 8.4 2.1 0.0 0.5 1.0 0.0 7.1 19.1 2020-02-03 6 0.1 0.0 0.0 0.0 0.0 1.5 10.6 12.2 2020-02-10 7 5.5 0.0 0.5 6.6 0.0 4.9 15.6 33.1 2020-02-17 8 0.2 3.3 1.0 3.8 0.0 0.5 1.0 9.8 2020-02-24 9 6.1 0.5 0.1 8.6 5.9 7.1 0.2 28.5 2020-03-02 10 0.0 0.0 4.3 0.0 3.0 12.4 0.0 19.7 ----------------------------------------------------------------------------------- Prod 3628800 0E-10 0E-10 0E-10 0E-10 0E-10 0E-10 0E-10 25803595102.2 '''.strip() self.max_rain = ''' Monday Week Mon Tue Wed Thu Fri Sat Sun Total ------------------------------------------------------------ 2019-12-30 1 0.0 0.2 0.0 0.0 1.2 0.0 0.0 1.4 2020-01-06 2 0.5 0.0 0.0 6.4 0.0 0.1 1.7 8.7 2020-01-13 3 5.3 1.7 9.1 3.0 1.7 0.0 0.0 20.8 2020-01-20 4 0.0 0.0 0.0 0.0 0.0 0.1 2.3 2.4 2020-01-27 5 8.4 2.1 0.0 0.5 1.0 0.0 7.1 19.1 2020-02-03 6 0.1 0.0 0.0 0.0 0.0 1.5 10.6 12.2 2020-02-10 7 5.5 0.0 0.5 6.6 0.0 4.9 15.6 33.1 2020-02-17 8 0.2 3.3 1.0 3.8 0.0 0.5 1.0 9.8 2020-02-24 9 6.1 0.5 0.1 8.6 5.9 7.1 0.2 28.5 2020-03-02 10 0.0 0.0 4.3 0.0 3.0 12.4 0.0 19.7 ------------------------------------------------------------ Max 10 8.4 3.3 9.1 8.6 5.9 12.4 15.6 33.1 '''.strip() self.q95_rain = ''' Monday Week Mon Tue Wed Thu Fri Sat Sun Total ----------------------------------------------------------------------- 2019-12-30 1 0.0 0.2 0.0 0.0 1.2 0.0 0.0 1.4 2020-01-06 2 0.5 0.0 0.0 6.4 0.0 0.1 1.7 8.7 2020-01-13 3 5.3 1.7 9.1 3.0 1.7 0.0 0.0 20.8 2020-01-20 4 0.0 0.0 0.0 0.0 0.0 0.1 2.3 2.4 2020-01-27 5 8.4 2.1 0.0 0.5 1.0 0.0 7.1 19.1 2020-02-03 6 0.1 0.0 0.0 0.0 0.0 1.5 10.6 12.2 2020-02-10 7 5.5 0.0 0.5 6.6 0.0 4.9 15.6 33.1 2020-02-17 8 0.2 3.3 1.0 3.8 0.0 0.5 1.0 9.8 2020-02-24 9 6.1 0.5 0.1 8.6 5.9 7.1 0.2 28.5 2020-03-02 10 0.0 0.0 4.3 0.0 3.0 12.4 0.0 19.7 ----------------------------------------------------------------------- Q95 10.45 9.435 3.84 11.26 9.5 7.205 14.785 17.85 35.17 '''.strip() self.q75_rain = ''' Monday Week Mon Tue Wed Thu Fri Sat Sun Total -------------------------------------------------------------------- 2019-12-30 1 0.0 0.2 0.0 0.0 1.2 0.0 0.0 1.4 2020-01-06 2 0.5 0.0 0.0 6.4 0.0 0.1 1.7 8.7 2020-01-13 3 5.3 1.7 9.1 3.0 1.7 0.0 0.0 20.8 2020-01-20 4 0.0 0.0 0.0 0.0 0.0 0.1 2.3 2.4 2020-01-27 5 8.4 2.1 0.0 0.5 1.0 0.0 7.1 19.1 2020-02-03 6 0.1 0.0 0.0 0.0 0.0 1.5 10.6 12.2 2020-02-10 7 5.5 0.0 0.5 6.6 0.0 4.9 15.6 33.1 2020-02-17 8 0.2 3.3 1.0 3.8 0.0 0.5 1.0 9.8 2020-02-24 9 6.1 0.5 0.1 8.6 5.9 7.1 0.2 28.5 2020-03-02 10 0.0 0.0 4.3 0.0 3.0 12.4 0.0 19.7 -------------------------------------------------------------------- Q75 8.25 5.65 1.8 1.825 6.45 2.025 5.45 7.975 22.725 '''.strip() self.median_rain = ''' Monday Week Mon Tue Wed Thu Fri Sat Sun Total --------------------------------------------------------------- 2019-12-30 1 0.0 0.2 0.0 0.0 1.2 0.0 0.0 1.4 2020-01-06 2 0.5 0.0 0.0 6.4 0.0 0.1 1.7 8.7 2020-01-13 3 5.3 1.7 9.1 3.0 1.7 0.0 0.0 20.8 2020-01-20 4 0.0 0.0 0.0 0.0 0.0 0.1 2.3 2.4 2020-01-27 5 8.4 2.1 0.0 0.5 1.0 0.0 7.1 19.1 2020-02-03 6 0.1 0.0 0.0 0.0 0.0 1.5 10.6 12.2 2020-02-10 7 5.5 0.0 0.5 6.6 0.0 4.9 15.6 33.1 2020-02-17 8 0.2 3.3 1.0 3.8 0.0 0.5 1.0 9.8 2020-02-24 9 6.1 0.5 0.1 8.6 5.9 7.1 0.2 28.5 2020-03-02 10 0.0 0.0 4.3 0.0 3.0 12.4 0.0 19.7 --------------------------------------------------------------- Median 5.5 0.35 0.1 0.05 1.75 0.5 0.3 1.35 15.65 '''.strip() self.sorted_by_total = ''' Monday Week Mon Tue Wed Thu Fri Sat Sun Total ---------------------------------------------------------------- 2019-12-30 1 0.0 0.2 0.0 0.0 1.2 0.0 0.0 1.4 2020-01-20 4 0.0 0.0 0.0 0.0 0.0 0.1 2.3 2.4 2020-01-06 2 0.5 0.0 0.0 6.4 0.0 0.1 1.7 8.7 2020-02-17 8 0.2 3.3 1.0 3.8 0.0 0.5 1.0 9.8 2020-02-03 6 0.1 0.0 0.0 0.0 0.0 1.5 10.6 12.2 2020-01-27 5 8.4 2.1 0.0 0.5 1.0 0.0 7.1 19.1 2020-03-02 10 0.0 0.0 4.3 0.0 3.0 12.4 0.0 19.7 2020-01-13 3 5.3 1.7 9.1 3.0 1.7 0.0 0.0 20.8 2020-02-24 9 6.1 0.5 0.1 8.6 5.9 7.1 0.2 28.5 2020-02-10 7 5.5 0.0 0.5 6.6 0.0 4.9 15.6 33.1 ---------------------------------------------------------------- Mean 5.5 2.61 0.78 1.5 2.89 1.28 2.66 3.85 15.57 '''.strip()
def setUp(self): self.tab = tabulate.Table() self.rain = ''' Monday Week Mon Tue Wed Thu Fri Sat Sun Total ----------------------------------------------------------- 2019-12-30 1 0.0 0.2 0.0 0.0 1.2 0.0 0.0 1.4 2020-01-06 2 0.5 0.0 0.0 6.4 0.0 0.1 1.7 8.7 2020-01-13 3 5.3 1.7 9.1 3.0 1.7 0.0 0.0 20.8 2020-01-20 4 0.0 0.0 0.0 0.0 0.0 0.1 2.3 2.4 2020-01-27 5 8.4 2.1 0.0 0.5 1.0 0.0 7.1 19.1 2020-02-03 6 0.1 0.0 0.0 0.0 0.0 1.5 10.6 12.2 2020-02-10 7 5.5 0.0 0.5 6.6 0.0 4.9 15.6 33.1 2020-02-17 8 0.2 3.3 1.0 3.8 0.0 0.5 1.0 9.8 2020-02-24 9 6.1 0.5 0.1 8.6 5.9 7.1 0.2 28.5 '''.strip() self.as_csv = ''' Monday,Week,Mon,Tue,Wed,Thu,Fri,Sat,Sun,Total 2019-12-30,1,0.0,0.2,0.0,0.0,1.2,0.0,0.0,1.4 2020-01-06,2,0.5,0.0,0.0,6.4,0.0,0.1,1.7,8.7 2020-01-13,3,5.3,1.7,9.1,3.0,1.7,0.0,0.0,20.8 2020-01-20,4,0.0,0.0,0.0,0.0,0.0,0.1,2.3,2.4 2020-01-27,5,8.4,2.1,0.0,0.5,1.0,0.0,7.1,19.1 2020-02-03,6,0.1,0.0,0.0,0.0,0.0,1.5,10.6,12.2 2020-02-10,7,5.5,0.0,0.5,6.6,0.0,4.9,15.6,33.1 2020-02-17,8,0.2,3.3,1.0,3.8,0.0,0.5,1.0,9.8 2020-02-24,9,6.1,0.5,0.1,8.6,5.9,7.1,0.2,28.5 '''.strip() self.as_markdown = ''' Monday | Week | Mon | Tue | Wed | Thu | Fri | Sat | Sun | Total ---------- | ---: | --: | --: | --: | --: | --: | --: | ---: | ----: 2019-12-30 | 1 | 0.0 | 0.2 | 0.0 | 0.0 | 1.2 | 0.0 | 0.0 | 1.4 2020-01-06 | 2 | 0.5 | 0.0 | 0.0 | 6.4 | 0.0 | 0.1 | 1.7 | 8.7 2020-01-13 | 3 | 5.3 | 1.7 | 9.1 | 3.0 | 1.7 | 0.0 | 0.0 | 20.8 2020-01-20 | 4 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.1 | 2.3 | 2.4 2020-01-27 | 5 | 8.4 | 2.1 | 0.0 | 0.5 | 1.0 | 0.0 | 7.1 | 19.1 2020-02-03 | 6 | 0.1 | 0.0 | 0.0 | 0.0 | 0.0 | 1.5 | 10.6 | 12.2 2020-02-10 | 7 | 5.5 | 0.0 | 0.5 | 6.6 | 0.0 | 4.9 | 15.6 | 33.1 2020-02-17 | 8 | 0.2 | 3.3 | 1.0 | 3.8 | 0.0 | 0.5 | 1.0 | 9.8 2020-02-24 | 9 | 6.1 | 0.5 | 0.1 | 8.6 | 5.9 | 7.1 | 0.2 | 28.5 '''.strip() self.as_tex = r''' Monday & Week & Mon & Tue & Wed & Thu & Fri & Sat & Sun & Total \cr \noalign{\vskip2pt\hrule\vskip4pt} 2019-12-30 & 1 & 0.0 & 0.2 & 0.0 & 0.0 & 1.2 & 0.0 & 0.0 & 1.4 \cr \noalign{\medskip} 2020-01-06 & 2 & 0.5 & 0.0 & 0.0 & 6.4 & 0.0 & 0.1 & 1.7 & 8.7 \cr 2020-01-13 & 3 & 5.3 & 1.7 & 9.1 & 3.0 & 1.7 & 0.0 & 0.0 & 20.8 \cr 2020-01-20 & 4 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.1 & 2.3 & 2.4 \cr 2020-01-27 & 5 & 8.4 & 2.1 & 0.0 & 0.5 & 1.0 & 0.0 & 7.1 & 19.1 \cr \noalign{\medskip} 2020-02-03 & 6 & 0.1 & 0.0 & 0.0 & 0.0 & 0.0 & 1.5 & 10.6 & 12.2 \cr 2020-02-10 & 7 & 5.5 & 0.0 & 0.5 & 6.6 & 0.0 & 4.9 & 15.6 & 33.1 \cr 2020-02-17 & 8 & 0.2 & 3.3 & 1.0 & 3.8 & 0.0 & 0.5 & 1.0 & 9.8 \cr 2020-02-24 & 9 & 6.1 & 0.5 & 0.1 & 8.6 & 5.9 & 7.1 & 0.2 & 28.5 \cr '''.strip() self.as_latex = r''' Monday & Week & Mon & Tue & Wed & Thu & Fri & Sat & Sun & Total \\ \hline 2019-12-30 & 1 & 0.0 & 0.2 & 0.0 & 0.0 & 1.2 & 0.0 & 0.0 & 1.4 \\ \noalign{\medskip} 2020-01-06 & 2 & 0.5 & 0.0 & 0.0 & 6.4 & 0.0 & 0.1 & 1.7 & 8.7 \\ 2020-01-13 & 3 & 5.3 & 1.7 & 9.1 & 3.0 & 1.7 & 0.0 & 0.0 & 20.8 \\ 2020-01-20 & 4 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.1 & 2.3 & 2.4 \\ 2020-01-27 & 5 & 8.4 & 2.1 & 0.0 & 0.5 & 1.0 & 0.0 & 7.1 & 19.1 \\ \noalign{\medskip} 2020-02-03 & 6 & 0.1 & 0.0 & 0.0 & 0.0 & 0.0 & 1.5 & 10.6 & 12.2 \\ 2020-02-10 & 7 & 5.5 & 0.0 & 0.5 & 6.6 & 0.0 & 4.9 & 15.6 & 33.1 \\ 2020-02-17 & 8 & 0.2 & 3.3 & 1.0 & 3.8 & 0.0 & 0.5 & 1.0 & 9.8 \\ 2020-02-24 & 9 & 6.1 & 0.5 & 0.1 & 8.6 & 5.9 & 7.1 & 0.2 & 28.5 \\ '''.strip() self.as_tsv = ''' Monday \tWeek\tMon\tTue\tWed\tThu\tFri\tSat\t Sun\tTotal 2019-12-30\t 1\t0.0\t0.2\t0.0\t0.0\t1.2\t0.0\t 0.0\t 1.4 2020-01-06\t 2\t0.5\t0.0\t0.0\t6.4\t0.0\t0.1\t 1.7\t 8.7 2020-01-13\t 3\t5.3\t1.7\t9.1\t3.0\t1.7\t0.0\t 0.0\t 20.8 2020-01-20\t 4\t0.0\t0.0\t0.0\t0.0\t0.0\t0.1\t 2.3\t 2.4 2020-01-27\t 5\t8.4\t2.1\t0.0\t0.5\t1.0\t0.0\t 7.1\t 19.1 2020-02-03\t 6\t0.1\t0.0\t0.0\t0.0\t0.0\t1.5\t10.6\t 12.2 2020-02-10\t 7\t5.5\t0.0\t0.5\t6.6\t0.0\t4.9\t15.6\t 33.1 2020-02-17\t 8\t0.2\t3.3\t1.0\t3.8\t0.0\t0.5\t 1.0\t 9.8 2020-02-24\t 9\t6.1\t0.5\t0.1\t8.6\t5.9\t7.1\t 0.2\t 28.5 '''.strip()
def test_nothing(self): self.nulltab = tabulate.Table() self.nulltab.parse_lines("") self.assertEqual(str(self.nulltab), '')