def test_get_tab_grid_good(): assert jtab.get_tab_grid("|------|------") == jtab.TabGrid( n_bars=2, n_steps_per_bar=6) assert jtab.get_tab_grid("|- - - |------") == jtab.TabGrid( n_bars=2, n_steps_per_bar=6) assert jtab.get_tab_grid("|- - - |------|") == jtab.TabGrid( n_bars=2, n_steps_per_bar=6) assert jtab.get_tab_grid("|abcd|defg|asdf") == jtab.TabGrid( n_bars=3, n_steps_per_bar=4) assert jtab.get_tab_grid("|abcd|defg|asdf|") == jtab.TabGrid( n_bars=3, n_steps_per_bar=4)
def test_get_tab_grid_garbage(): with pytest.raises(jtab.NotGridlike): jtab.get_tab_grid("asdf0candf18") with pytest.raises(jtab.NotGridlike): jtab.get_tab_grid("asdf0ca|ndf18")
def test_get_tab_single_pipe(): with pytest.raises(jtab.NotGridlike): jtab.get_tab_grid("|------")
def test_get_tab_grid_empty(): with pytest.raises(jtab.NotGridlike): jtab.get_tab_grid("")
def test_get_tab_grid_inconsistent_width(): with pytest.raises(jtab.InconsistentBarWidth): jtab.get_tab_grid("||-|--|---|")