| Conditions | 5 |
| Total Lines | 38 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 2 | ||
| Bugs | 0 | Features | 1 |
| 1 | #!/usr/bin/env python3 |
||
| 7 | def test_read_csv(): |
||
| 8 | include = None |
||
| 9 | # check type |
||
| 10 | data = r"""1,2 |
||
| 11 | 3,4 |
||
| 12 | """ |
||
| 13 | assert read_csv(include, data) == [ |
||
| 14 | ['1', '2'], |
||
| 15 | ['3', '4'] |
||
| 16 | ] |
||
| 17 | # check complex cells |
||
| 18 | data = r"""asdfdfdfguhfdhghfdgkla,"334 |
||
| 19 | 2",**la**,4 |
||
| 20 | 5,6,7,8""" |
||
| 21 | assert read_csv(include, data) == [ |
||
| 22 | ['asdfdfdfguhfdhghfdgkla', '334\n2', '**la**', '4'], |
||
| 23 | ['5', '6', '7', '8'] |
||
| 24 | ] |
||
| 25 | # check include |
||
| 26 | include = 'tests/csv_tables.csv' |
||
| 27 | assert read_csv(include, |
||
| 28 | data) == [['**_Fruit_**', |
||
| 29 | '~~Price~~', |
||
| 30 | '_Number_', |
||
| 31 | '`Advantages`'], |
||
| 32 | ['*Bananas~1~*', |
||
| 33 | '$1.34', |
||
| 34 | '12~units~', |
||
| 35 | 'Benefits of eating bananas \n(**Note the appropriately\nrendered block markdown**): \n\n- _built-in wrapper_ \n- ~~**bright color**~~\n\n'], |
||
| 36 | ['*Oranges~2~*', |
||
| 37 | '$2.10', |
||
| 38 | '5^10^~units~', |
||
| 39 | 'Benefits of eating oranges:\n\n- **cures** scurvy\n- `tasty`']] |
||
| 40 | # check empty table |
||
| 41 | include = None |
||
| 42 | data = '' |
||
| 43 | assert read_csv(include, data) == [] |
||
| 44 | return |
||
| 45 |