Repository: pri22296/beautifultable

Issue:
Printing table built using column appending fails in v1.0.0
If a table is constructed by appending columns then attempting to print the table fails.

For example:

```python
from beautifultable import BeautifulTable

tbl = BeautifulTable()
tbl.columns.append(["aaa", "bbb", "ccc"], header="One")
tbl.columns.append(["ddd", "eee", "fff"], header="Two")
tbl.columns.append(["ggg", "hhh", "iii"], header="Three")
print(tbl)
```

Produces this error:

```
Traceback (most recent call last):
  File "append_column.py", line 10, in <module>
    print(tbl)
  File "/usr/local/lib/python3.5/dist-packages/beautifultable/beautifultable.py", line 412, in __str__
    for line in self._get_string([], append=False):
  File "/usr/local/lib/python3.5/dist-packages/beautifultable/beautifultable.py", line 1083, in _get_string
    self.rows.insert(0, self.columns.header)
  File "/usr/local/lib/python3.5/dist-packages/beautifultable/helpers.py", line 512, in insert
    self._table._data._insert(index, BTRowData(self._table, row))
AttributeError: 'list' object has no attribute '_insert'
```

Swapping `columns` for `rows` in the above code works (but the table is then rotated by 90 degrees, obv.).

Tested under Python 3.7 on FreeBSD 11.4 and Python 3.5 on Debian 9.13 (Raspberry Pi).

Discussion:
codecov[bot]: # [Codecov](https://codecov.io/gh/pri22296/beautifultable/pull/111?src=pr&el=h1) Report
> Merging [#111](https://codecov.io/gh/pri22296/beautifultable/pull/111?src=pr&el=desc) (20e97b9) into [master](https://codecov.io/gh/pri22296/beautifultable/commit/e16c15890496aa018746c4d333a533f7ba57b6f2?el=desc) (e16c158) will **not change** coverage.
> The diff coverage is `0.00%`.

[![Impacted file tree graph](https://codecov.io/gh/pri22296/beautifultable/pull/111/graphs/tree.svg?width=650&height=150&src=pr&token=JGEoYMIaay)](https://codecov.io/gh/pri22296/beautifultable/pull/111?src=pr&el=tree)

```diff
@@           Coverage Diff           @@
##           master     #111   +/-   ##
=======================================
  Coverage   81.98%   81.98%           
=======================================
  Files          11       11           
  Lines        1321     1321           
  Branches      208      208           
=======================================
  Hits         1083     1083           
  Misses        160      160           
  Partials       78       78           
```


| [Impacted Files](https://codecov.io/gh/pri22296/beautifultable/pull/111?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [beautifultable/helpers.py](https://codecov.io/gh/pri22296/beautifultable/pull/111/diff?src=pr&el=tree#diff-YmVhdXRpZnVsdGFibGUvaGVscGVycy5weQ==) | `75.83% <0.00%> (ø)` | |

------

[Continue to review full report at Codecov](https://codecov.io/gh/pri22296/beautifultable/pull/111?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/pri22296/beautifultable/pull/111?src=pr&el=footer). Last update [e16c158...20e97b9](https://codecov.io/gh/pri22296/beautifultable/pull/111?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).


Patch:
diff --git a/beautifultable/beautifultable.py b/beautifultable/beautifultable.py
index 38eca7b..1566643 100644
--- a/beautifultable/beautifultable.py
+++ b/beautifultable/beautifultable.py
@@ -814,7 +814,10 @@ class BeautifulTable(object):
                 header, self.detect_numerics, self.precision, self.sign.value
             ).split("\n"):
                 output_str = pre_process(
-                    i, self.detect_numerics, self.precision, self.sign.value,
+                    i,
+                    self.detect_numerics,
+                    self.precision,
+                    self.sign.value,
                 )
                 max_length = max(max_length, termwidth(output_str))
             maxwidths[index] += max_length
@@ -952,7 +955,8 @@ class BeautifulTable(object):
             if termwidth(self.border.left) > 0:
                 if not (self.border.left.isspace() and visible_junc):
                     length = min(
-                        termwidth(self.border.left), termwidth(intersect_left),
+                        termwidth(self.border.left),
+                        termwidth(intersect_left),
                     )
                     for i in range(length):
                         line[i] = intersect_left[i] if mask[0] else " "
diff --git a/beautifultable/helpers.py b/beautifultable/helpers.py
index 2171fb1..16f960b 100644
--- a/beautifultable/helpers.py
+++ b/beautifultable/helpers.py
@@ -239,7 +239,10 @@ class BTRowData(BTBaseRow):
         for row in map(list, zip_longest(*rows, fillvalue="")):
             for i in range(len(row)):
                 row[i] = pre_process(
-                    row[i], table.detect_numerics, table.precision, sign.value,
+                    row[i],
+                    table.detect_numerics,
+                    table.precision,
+                    sign.value,
                 )
             for row_ in self._clamp_row(row):
                 for i in range(len(table.columns)):
@@ -1145,7 +1148,9 @@ class BTColumnCollection(object):
             self.padding_left = [padding_left]
             self.padding_right = [padding_right]
             self.alignment = [alignment]
-            self._table._data = [BTRowData(self._table, [i]) for i in column]
+            self._table._data = type(self._table._data)(
+                self._table, [BTRowData(self._table, [i]) for i in column]
+            )
         else:
             if (not isinstance(header, basestring)) and (header is not None):
                 raise TypeError(
diff --git a/beautifultable/utils.py b/beautifultable/utils.py
index 69e4893..06a44eb 100644
--- a/beautifultable/utils.py
+++ b/beautifultable/utils.py
@@ -83,7 +83,10 @@ def deprecation_message(
 
 
 def deprecated(
-    deprecated_in, removed_in, replacement=None, details=None,
+    deprecated_in,
+    removed_in,
+    replacement=None,
+    details=None,
 ):  # pragma: no cover
     def decorator(f):
         @functools.wraps(f)
@@ -93,20 +96,29 @@ def deprecated(
                 if replacement:
                     details = replacement.__qualname__
                     details = details.replace(
-                        "BTColumns", "BeautifulTable.columns",
+                        "BTColumns",
+                        "BeautifulTable.columns",
                     )
-                    details = details.replace("BTRows", "BeautifulTable.rows",)
                     details = details.replace(
-                        "BTColumnHeader", "BeautifulTable.columns.header",
+                        "BTRows",
+                        "BeautifulTable.rows",
                     )
                     details = details.replace(
-                        "BTRowHeader", "BeautifulTable.rows.header",
+                        "BTColumnHeader",
+                        "BeautifulTable.columns.header",
+                    )
+                    details = details.replace(
+                        "BTRowHeader",
+                        "BeautifulTable.rows.header",
                     )
                     details = "Use '{}' instead.".format(details)
                 else:
                     details = ""
             message = deprecation_message(
-                f.__qualname__, deprecated_in, removed_in, details,
+                f.__qualname__,
+                deprecated_in,
+                removed_in,
+                details,
             )
             if replacement:
                 f.__doc__ = "{}\n\n{}".format(replacement.__doc__, message)
@@ -119,7 +131,11 @@ def deprecated(
 
 
 def deprecated_param(
-    deprecated_in, removed_in, old_name, new_name=None, details=None,
+    deprecated_in,
+    removed_in,
+    old_name,
+    new_name=None,
+    details=None,
 ):  # pragma: no cover
     def decorator(f):
         @functools.wraps(f)
@@ -130,7 +146,10 @@ def deprecated_param(
                     "Use '{}' instead.".format(new_name) if new_name else ""
                 )
             message = deprecation_message(
-                old_name, deprecated_in, removed_in, details,
+                old_name,
+                deprecated_in,
+                removed_in,
+                details,
             )
             if old_name in kwargs:
                 warnings.warn(message, FutureWarning)


Test patch:
diff --git a/test.py b/test.py
index 5671be6..ca6455d 100644
--- a/test.py
+++ b/test.py
@@ -130,6 +130,26 @@ class TableOperationsTestCase(unittest.TestCase):
         last_column = self.table.columns[len(self.table.columns) - 1]
         self.compare_iterable(column, last_column)
 
+    def test_append_column_empty_table(self):
+        self.table = BeautifulTable()
+        title = "year"
+        column = ["2010", "2012", "2008", "2010", "2011"]
+        self.table.columns.append(column, header=title)
+        string = """+------+
+| year |
++------+
+| 2010 |
++------+
+| 2012 |
++------+
+| 2008 |
++------+
+| 2010 |
++------+
+| 2011 |
++------+"""
+        self.assertEqual(string, str(self.table))
+
     def test_insert_column(self):
         column = ["2010", "2012", "2008", "2010", "2011"]
         title = "year"