Skip to content
This repository has been archived by the owner on Dec 7, 2021. It is now read-only.

Commit

Permalink
Only Ascii and Unix tables.
Browse files Browse the repository at this point in the history
Unicode characters don't "connect" between lines. Gaps make the table
look ugly. Giving up on this.

Since the only additional classes were for DOS, I'd rather not support
that at this time. Dropping that too.

Code complete.
  • Loading branch information
Robpol86 committed Sep 11, 2014
1 parent b098fd0 commit 68e98e2
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 42 deletions.
16 changes: 0 additions & 16 deletions terminaltables.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,19 +241,3 @@ def table(self):
ascii_table = super(UnixTable, self).table
optimized = ascii_table.replace('\033(B\033(0', '')
return optimized


class DosSingleTable(AsciiTable):
pass


class DosDoubleTable(AsciiTable):
pass


class UnicodeSingleTable(AsciiTable):
pass


class UnicodeDoubleTable(AsciiTable):
pass
12 changes: 4 additions & 8 deletions tests/test_column_widths.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,10 @@

import pytest

from terminaltables import (
AsciiTable, DosDoubleTable, DosSingleTable, UnicodeDoubleTable, UnicodeSingleTable, UnixTable
)
from terminaltables import AsciiTable, UnixTable

CLASSES = [AsciiTable, DosDoubleTable, DosSingleTable, UnicodeDoubleTable, UnicodeSingleTable, UnixTable]


@pytest.mark.parametrize('cls', CLASSES)
@pytest.mark.parametrize('cls', [AsciiTable, UnixTable])
def test_empty(cls):
table = cls([])
assert [] == table.column_widths
Expand All @@ -24,7 +20,7 @@ def test_empty(cls):
assert [1] == table.column_widths


@pytest.mark.parametrize('cls', CLASSES)
@pytest.mark.parametrize('cls', [AsciiTable, UnixTable])
def test_simple(cls):
table_data = [
['Name', 'Color', 'Type'],
Expand All @@ -40,7 +36,7 @@ def test_simple(cls):
assert [10, 5, 9] == table.column_widths


@pytest.mark.parametrize('cls', CLASSES)
@pytest.mark.parametrize('cls', [AsciiTable, UnixTable])
def test_multi_line(cls):
table_data = [
['Show', 'Characters'],
Expand Down
14 changes: 5 additions & 9 deletions tests/test_max_width.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,10 @@

import pytest

from terminaltables import (
AsciiTable, DosDoubleTable, DosSingleTable, UnicodeDoubleTable, UnicodeSingleTable, UnixTable
)
from terminaltables import AsciiTable, UnixTable

CLASSES = [AsciiTable, DosDoubleTable, DosSingleTable, UnicodeDoubleTable, UnicodeSingleTable, UnixTable]


@pytest.mark.parametrize('cls', CLASSES)
@pytest.mark.parametrize('cls', [AsciiTable, UnixTable])
def test_empty(cls):
class FakeCls(cls):
terminal_width = 80
Expand Down Expand Up @@ -37,7 +33,7 @@ class FakeCls(cls):
table.column_max_width(1)


@pytest.mark.parametrize('cls', CLASSES)
@pytest.mark.parametrize('cls', [AsciiTable, UnixTable])
def test_simple(cls):
class FakeCls(cls):
terminal_width = 80
Expand All @@ -60,7 +56,7 @@ class FakeCls(cls):
assert 55 == table.column_max_width(2)


@pytest.mark.parametrize('cls', CLASSES)
@pytest.mark.parametrize('cls', [AsciiTable, UnixTable])
def test_attributes(cls):
class FakeCls(cls):
terminal_width = 80
Expand Down Expand Up @@ -100,7 +96,7 @@ class FakeCls(cls):
assert 49 == table.column_max_width(2)


@pytest.mark.parametrize('cls', CLASSES)
@pytest.mark.parametrize('cls', [AsciiTable, UnixTable])
def test_multi_line(cls):
class FakeCls(cls):
terminal_width = 80
Expand Down
14 changes: 5 additions & 9 deletions tests/test_padded_table_data.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
import pytest

from terminaltables import (
AsciiTable, DosDoubleTable, DosSingleTable, UnicodeDoubleTable, UnicodeSingleTable, UnixTable
)
from terminaltables import AsciiTable, UnixTable

CLASSES = [AsciiTable, DosDoubleTable, DosSingleTable, UnicodeDoubleTable, UnicodeSingleTable, UnixTable]


@pytest.mark.parametrize('cls', CLASSES)
@pytest.mark.parametrize('cls', [AsciiTable, UnixTable])
def test_empty(cls):
table = cls([])
assert [] == table.padded_table_data
Expand All @@ -22,7 +18,7 @@ def test_empty(cls):
assert [[' ']] == table.padded_table_data


@pytest.mark.parametrize('cls', CLASSES)
@pytest.mark.parametrize('cls', [AsciiTable, UnixTable])
def test_simple(cls):
table_data = [
['Name', 'Color', 'Type'],
Expand Down Expand Up @@ -53,7 +49,7 @@ def test_simple(cls):
assert expected == table.padded_table_data


@pytest.mark.parametrize('cls', CLASSES)
@pytest.mark.parametrize('cls', [AsciiTable, UnixTable])
def test_attributes(cls):
table_data = [
['Name', 'Color', 'Type'],
Expand Down Expand Up @@ -85,7 +81,7 @@ def test_attributes(cls):
assert expected == table.padded_table_data


@pytest.mark.parametrize('cls', CLASSES)
@pytest.mark.parametrize('cls', [AsciiTable, UnixTable])
def test_multi_line(cls):
table_data = [
['A', 'B', 'C'],
Expand Down

0 comments on commit 68e98e2

Please sign in to comment.