flexablelib 2.0.17__tar.gz → 2.0.18__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. {flexablelib-2.0.17 → flexablelib-2.0.18}/CHANGELOG.md +26 -0
  2. {flexablelib-2.0.17/flexablelib.egg-info → flexablelib-2.0.18}/PKG-INFO +2 -2
  3. {flexablelib-2.0.17 → flexablelib-2.0.18}/README.md +1 -1
  4. {flexablelib-2.0.17 → flexablelib-2.0.18}/flexablelib/table.py +82 -26
  5. {flexablelib-2.0.17 → flexablelib-2.0.18/flexablelib.egg-info}/PKG-INFO +2 -2
  6. {flexablelib-2.0.17 → flexablelib-2.0.18}/flexablelib.egg-info/SOURCES.txt +1 -0
  7. flexablelib-2.0.18/package.json +16 -0
  8. {flexablelib-2.0.17 → flexablelib-2.0.18}/tests/test_v217_features.py +14 -3
  9. flexablelib-2.0.18/tests/test_v218_features.py +108 -0
  10. flexablelib-2.0.17/package.json +0 -47
  11. {flexablelib-2.0.17 → flexablelib-2.0.18}/LICENSE +0 -0
  12. {flexablelib-2.0.17 → flexablelib-2.0.18}/MANIFEST.in +0 -0
  13. {flexablelib-2.0.17 → flexablelib-2.0.18}/flexablelib/__init__.py +0 -0
  14. {flexablelib-2.0.17 → flexablelib-2.0.18}/flexablelib/_speedups.c +0 -0
  15. {flexablelib-2.0.17 → flexablelib-2.0.18}/flexablelib/_width_tables.h +0 -0
  16. {flexablelib-2.0.17 → flexablelib-2.0.18}/flexablelib/cells.py +0 -0
  17. {flexablelib-2.0.17 → flexablelib-2.0.18}/flexablelib/colors.py +0 -0
  18. {flexablelib-2.0.17 → flexablelib-2.0.18}/flexablelib/columns.py +0 -0
  19. {flexablelib-2.0.17 → flexablelib-2.0.18}/flexablelib/fast.py +0 -0
  20. {flexablelib-2.0.17 → flexablelib-2.0.18}/flexablelib/merges.py +0 -0
  21. {flexablelib-2.0.17 → flexablelib-2.0.18}/flexablelib/options.py +0 -0
  22. {flexablelib-2.0.17 → flexablelib-2.0.18}/flexablelib/py.typed +0 -0
  23. {flexablelib-2.0.17 → flexablelib-2.0.18}/flexablelib/readers.py +0 -0
  24. {flexablelib-2.0.17 → flexablelib-2.0.18}/flexablelib/style_compositions.py +0 -0
  25. {flexablelib-2.0.17 → flexablelib-2.0.18}/flexablelib/table_strings.py +0 -0
  26. {flexablelib-2.0.17 → flexablelib-2.0.18}/flexablelib/text_width.py +0 -0
  27. {flexablelib-2.0.17 → flexablelib-2.0.18}/flexablelib/utils.py +0 -0
  28. {flexablelib-2.0.17 → flexablelib-2.0.18}/flexablelib/writers.py +0 -0
  29. {flexablelib-2.0.17 → flexablelib-2.0.18}/flexablelib.egg-info/dependency_links.txt +0 -0
  30. {flexablelib-2.0.17 → flexablelib-2.0.18}/flexablelib.egg-info/requires.txt +0 -0
  31. {flexablelib-2.0.17 → flexablelib-2.0.18}/flexablelib.egg-info/top_level.txt +0 -0
  32. {flexablelib-2.0.17 → flexablelib-2.0.18}/pytest.ini +0 -0
  33. {flexablelib-2.0.17 → flexablelib-2.0.18}/setup.cfg +0 -0
  34. {flexablelib-2.0.17 → flexablelib-2.0.18}/setup.py +0 -0
  35. {flexablelib-2.0.17 → flexablelib-2.0.18}/style_examples.md +0 -0
  36. {flexablelib-2.0.17 → flexablelib-2.0.18}/tests/conftest.py +0 -0
  37. {flexablelib-2.0.17 → flexablelib-2.0.18}/tests/helpers.py +0 -0
  38. {flexablelib-2.0.17 → flexablelib-2.0.18}/tests/test_cells.py +0 -0
  39. {flexablelib-2.0.17 → flexablelib-2.0.18}/tests/test_columns.py +0 -0
  40. {flexablelib-2.0.17 → flexablelib-2.0.18}/tests/test_excel.py +0 -0
  41. {flexablelib-2.0.17 → flexablelib-2.0.18}/tests/test_features.py +0 -0
  42. {flexablelib-2.0.17 → flexablelib-2.0.18}/tests/test_issues.py +0 -0
  43. {flexablelib-2.0.17 → flexablelib-2.0.18}/tests/test_merge_edge_matrix.py +0 -0
  44. {flexablelib-2.0.17 → flexablelib-2.0.18}/tests/test_merges.py +0 -0
  45. {flexablelib-2.0.17 → flexablelib-2.0.18}/tests/test_readme_examples.py +0 -0
  46. {flexablelib-2.0.17 → flexablelib-2.0.18}/tests/test_styles.py +0 -0
  47. {flexablelib-2.0.17 → flexablelib-2.0.18}/tests/test_text_width.py +0 -0
  48. {flexablelib-2.0.17 → flexablelib-2.0.18}/tests/test_two_pass_measurement.py +0 -0
  49. {flexablelib-2.0.17 → flexablelib-2.0.18}/tests/test_upstream_issues.py +0 -0
  50. {flexablelib-2.0.17 → flexablelib-2.0.18}/tests/test_v213_features.py +0 -0
  51. {flexablelib-2.0.17 → flexablelib-2.0.18}/tests/test_v214_features.py +0 -0
  52. {flexablelib-2.0.17 → flexablelib-2.0.18}/tests/test_v215_features.py +0 -0
  53. {flexablelib-2.0.17 → flexablelib-2.0.18}/tests/test_v216_features.py +0 -0
  54. {flexablelib-2.0.17 → flexablelib-2.0.18}/tools/benchmark.py +0 -0
  55. {flexablelib-2.0.17 → flexablelib-2.0.18}/tools/generate_width_tables.py +0 -0
  56. {flexablelib-2.0.17 → flexablelib-2.0.18}/tools/readme_gallery.py +0 -0
  57. {flexablelib-2.0.17 → flexablelib-2.0.18}/tools/text_to_png.py +0 -0
@@ -2,6 +2,32 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ## [2.0.18] - 2026-10-31
6
+
7
+ ### Fixed
8
+ - ``border_text(..., align='right' | 'center')`` now works with the default
9
+ offset; you no longer have to pass ``offset=None``. The ``offset`` default
10
+ is now ``None`` (automatic: a one-cell margin inside the frame corners).
11
+ An explicit ``offset`` is a margin from the aligned edge: the start column
12
+ for ``left`` (unchanged), the gap before the right edge for ``right``, and
13
+ the margin on both sides for ``center``. Default (left) placement is
14
+ unchanged.
15
+ - ``border_text`` on ``where='left' | 'right'`` honours ``align`` too
16
+ (``left`` = top, ``center``, ``right`` = bottom) and, by default, no longer
17
+ overwrites the top corner.
18
+ - ``border_text`` rejects a negative or non-integer ``offset`` with a clear
19
+ error.
20
+
21
+ ### Packaging
22
+ - CPython **3.14** wheels (Linux manylinux/musllinux, Windows, macOS) via
23
+ cibuildwheel 3.4.1.
24
+ - Removed the unused npm toolchain (commitlint, husky, standard-version…) and
25
+ ``package-lock.json``. ``package.json`` only carries the version number now,
26
+ which clears all 35 Dependabot alerts; none of them ever reached PyPI users.
27
+ - The test suite passes against an installed package with only ``tests/``,
28
+ ``pytest.ini`` and ``style_examples.md`` copied next to it (the conda-forge
29
+ recipe layout, #26): checks that need a source checkout now skip there.
30
+
5
31
  ## [2.0.17] - 2026-10-31
6
32
 
7
33
  ### Security
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: flexablelib
3
- Version: 2.0.17
3
+ Version: 2.0.18
4
4
  Summary: Fast, dependency-free terminal tables for Python: 56 border styles, ANSI colors, cell merges, decimal alignment, width fitting, and CSV/Markdown/HTML/Excel/LaTeX I/O.
5
5
  Home-page: https://github.com/Opus-Perpetuus/flexablelib
6
6
  Author: Benjamin Ramirez
@@ -479,7 +479,7 @@ flexablelib/ # GitHub repository
479
479
  ├── logos/ brand assets — see logos/README.md
480
480
  ├── ARCHITECTURE.md how it all fits together
481
481
  ├── style_examples.md all 56 styles rendered
482
- ├── package.json canonical version number; drives the release
482
+ ├── package.json canonical version number (no npm deps)
483
483
  └── setup.py reads the version from package.json
484
484
  ```
485
485
 
@@ -414,7 +414,7 @@ flexablelib/ # GitHub repository
414
414
  ├── logos/ brand assets — see logos/README.md
415
415
  ├── ARCHITECTURE.md how it all fits together
416
416
  ├── style_examples.md all 56 styles rendered
417
- ├── package.json canonical version number; drives the release
417
+ ├── package.json canonical version number (no npm deps)
418
418
  └── setup.py reads the version from package.json
419
419
  ```
420
420
 
@@ -2699,7 +2699,7 @@ class Table(object):
2699
2699
  def border_color(self, value):
2700
2700
  self.__border_color = value
2701
2701
 
2702
- def border_text(self, text, where='top', color=None, offset=1, align='left'):
2702
+ def border_text(self, text, where='top', color=None, offset=None, align='left'):
2703
2703
  """
2704
2704
  Overlay ``text`` on a border line (inspired by tabled ``LineText``).
2705
2705
 
@@ -2711,12 +2711,25 @@ class Table(object):
2711
2711
  'bottom' / 'end' – bottom frame
2712
2712
  'left' / 'right' – vertical outer borders
2713
2713
 
2714
- ``offset`` is the visible column (horizontal) or row (vertical) where
2715
- the text starts; junctions outside the span are preserved when the
2716
- text does not overwrite them. ``color`` paints the text foreground
2717
- (``border_color`` still paints the remaining chrome). ``align`` is
2718
- ``left``, ``center``, or ``right`` within the writable span when
2719
- ``offset`` is None.
2714
+ ``align`` is ``left``, ``center`` or ``right`` (``l``/``c``/``r``).
2715
+ On the vertical borders ``left`` means top and ``right`` means bottom.
2716
+
2717
+ ``offset`` is a margin measured from the aligned edge, in visible
2718
+ columns (horizontal) or lines (vertical):
2719
+
2720
+ - ``align='left'``: the text starts ``offset`` columns from the left
2721
+ edge (the historical meaning; ``offset=0`` overwrites the corner).
2722
+ - ``align='right'``: the text ends ``offset`` columns before the
2723
+ right edge.
2724
+ - ``align='center'``: the text is centred between margins of
2725
+ ``offset`` on both sides.
2726
+
2727
+ ``offset=None`` (the default) is automatic: a margin of 1, so the
2728
+ label sits just inside the frame corners and never overwrites them.
2729
+ ``table.border_text('v2', align='right')`` therefore works without
2730
+ any offset. Junctions outside the text are preserved. ``color`` paints
2731
+ the text foreground (``border_color`` still paints the remaining
2732
+ chrome).
2720
2733
 
2721
2734
  Multiple calls accumulate; use ``clear_border_texts()`` to reset.
2722
2735
  """
@@ -2745,6 +2758,17 @@ class Table(object):
2745
2758
  align_key = (align or 'left').lower()
2746
2759
  if align_key not in ('left', 'center', 'right', 'l', 'c', 'r'):
2747
2760
  raise ValueError(f"Unknown border_text align={align!r}")
2761
+ if offset is not None:
2762
+ try:
2763
+ offset = int(offset)
2764
+ except (TypeError, ValueError):
2765
+ raise TypeError(
2766
+ f"border_text offset must be an int or None, got {offset!r}"
2767
+ ) from None
2768
+ if offset < 0:
2769
+ raise ValueError(
2770
+ f"border_text offset must be >= 0, got {offset!r}"
2771
+ )
2748
2772
  align_key = {'l': 'left', 'c': 'center', 'r': 'right'}.get(
2749
2773
  align_key, align_key
2750
2774
  )
@@ -5062,14 +5086,49 @@ class Table(object):
5062
5086
  )
5063
5087
  return specs
5064
5088
 
5065
- def __overlay_line_text(self, line, text, offset=1, color=None,
5089
+ @staticmethod
5090
+ def _border_text_span(length, text_len, offset, align, lo, hi):
5091
+ """
5092
+ Where a ``border_text`` label goes on a line (or column) of
5093
+ ``length`` cells: returns ``(start, stop)``; the label is written from
5094
+ ``start`` and truncated at ``stop``.
5095
+
5096
+ ``lo``/``hi`` bound the writable span inside the frame corners and are
5097
+ used when ``offset`` is None (automatic margin). An explicit
5098
+ ``offset`` is a margin from the aligned edge; for ``left`` it is the
5099
+ absolute start, exactly as before 2.0.18.
5100
+ """
5101
+ if offset is None:
5102
+ first, last = lo, hi
5103
+ if align == 'left':
5104
+ # Historic default was offset=1: keep it on corner-less lines.
5105
+ first = min(1, length)
5106
+ else:
5107
+ margin = int(offset)
5108
+ if align == 'left':
5109
+ first, last = margin, (hi if margin < hi else length)
5110
+ elif align == 'right':
5111
+ first, last = lo, max(lo, length - margin)
5112
+ else:
5113
+ first, last = margin, max(margin, length - margin)
5114
+ span = max(0, last - first)
5115
+ if align == 'center':
5116
+ start = first + max(0, (span - text_len) // 2)
5117
+ elif align == 'right':
5118
+ start = first + max(0, span - text_len)
5119
+ else:
5120
+ start = first
5121
+ return start, last
5122
+
5123
+ def __overlay_line_text(self, line, text, offset=None, color=None,
5066
5124
  align='left', chrome_color=None):
5067
5125
  """
5068
5126
  Replace a span of ``line`` with ``text`` (tabled LineText spirit).
5069
5127
 
5070
5128
  Works on ANSI-coloured lines by stripping for geometry, then rebuilding
5071
5129
  ``prefix + colored_text + suffix``. Truncates text that does not fit.
5072
- ``offset`` None means place by ``align`` inside the full line width.
5130
+ Placement (``offset`` + ``align``) is worked out by
5131
+ ``_border_text_span``.
5073
5132
  ``chrome_color`` (defaults to ``border_color``) repaints the non-text
5074
5133
  segments so overlays do not strip an existing border foreground.
5075
5134
  """
@@ -5089,19 +5148,10 @@ class Table(object):
5089
5148
  # overlong label never eats the frame's closing junction.
5090
5149
  lo = 1 if width > 2 and not chars[0].isspace() else 0
5091
5150
  hi = width - 1 if width > 2 and not chars[-1].isspace() else width
5092
- if offset is None:
5093
- span = hi - lo
5094
- if align == 'center':
5095
- start = lo + max(0, (span - tw) // 2)
5096
- elif align == 'right':
5097
- start = lo + max(0, span - tw)
5098
- else:
5099
- start = lo
5100
- else:
5101
- start = max(0, int(offset))
5151
+ start, stop = self._border_text_span(width, tw, offset, align, lo, hi)
5102
5152
  if start >= width:
5103
5153
  return line
5104
- available = (hi if start < hi else width) - start
5154
+ available = stop - start
5105
5155
  if tw > available:
5106
5156
  text_chars = text_chars[:available]
5107
5157
  tw = len(text_chars)
@@ -5179,10 +5229,13 @@ class Table(object):
5179
5229
  text = strip_ansi(spec['text'])
5180
5230
  if not text:
5181
5231
  continue
5182
- offset = 0 if spec['offset'] is None else int(spec['offset'])
5232
+ start, stop = self._border_text_span(
5233
+ n, len(text), spec['offset'], spec['align'],
5234
+ 1 if n > 2 else 0, n - 1 if n > 2 else n,
5235
+ )
5183
5236
  for i, ch in enumerate(text):
5184
- row = offset + i
5185
- if row < 0 or row >= n:
5237
+ row = start + i
5238
+ if row < 0 or row >= stop:
5186
5239
  break
5187
5240
  lines[row] = self.__replace_first_visible(
5188
5241
  lines[row], ch, spec['color']
@@ -5192,10 +5245,13 @@ class Table(object):
5192
5245
  text = strip_ansi(spec['text'])
5193
5246
  if not text:
5194
5247
  continue
5195
- offset = 0 if spec['offset'] is None else int(spec['offset'])
5248
+ start, stop = self._border_text_span(
5249
+ n, len(text), spec['offset'], spec['align'],
5250
+ 1 if n > 2 else 0, n - 1 if n > 2 else n,
5251
+ )
5196
5252
  for i, ch in enumerate(text):
5197
- row = offset + i
5198
- if row < 0 or row >= n:
5253
+ row = start + i
5254
+ if row < 0 or row >= stop:
5199
5255
  break
5200
5256
  lines[row] = self.__replace_last_visible(
5201
5257
  lines[row], ch, spec['color']
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: flexablelib
3
- Version: 2.0.17
3
+ Version: 2.0.18
4
4
  Summary: Fast, dependency-free terminal tables for Python: 56 border styles, ANSI colors, cell merges, decimal alignment, width fitting, and CSV/Markdown/HTML/Excel/LaTeX I/O.
5
5
  Home-page: https://github.com/Opus-Perpetuus/flexablelib
6
6
  Author: Benjamin Ramirez
@@ -479,7 +479,7 @@ flexablelib/ # GitHub repository
479
479
  ├── logos/ brand assets — see logos/README.md
480
480
  ├── ARCHITECTURE.md how it all fits together
481
481
  ├── style_examples.md all 56 styles rendered
482
- ├── package.json canonical version number; drives the release
482
+ ├── package.json canonical version number (no npm deps)
483
483
  └── setup.py reads the version from package.json
484
484
  ```
485
485
 
@@ -48,6 +48,7 @@ tests/test_v214_features.py
48
48
  tests/test_v215_features.py
49
49
  tests/test_v216_features.py
50
50
  tests/test_v217_features.py
51
+ tests/test_v218_features.py
51
52
  tools/benchmark.py
52
53
  tools/generate_width_tables.py
53
54
  tools/readme_gallery.py
@@ -0,0 +1,16 @@
1
+ {
2
+ "name": "flexablelib",
3
+ "version": "2.0.18",
4
+ "private": true,
5
+ "description": "Flexible console and HTML tables for Python: styles, merges, colors, widths, decimal alignment.",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/Opus-Perpetuus/flexablelib.git"
9
+ },
10
+ "author": "Kyostenas",
11
+ "license": "MIT",
12
+ "bugs": {
13
+ "url": "https://github.com/Opus-Perpetuus/flexablelib/issues"
14
+ },
15
+ "homepage": "https://github.com/Opus-Perpetuus/flexablelib#readme"
16
+ }
@@ -87,11 +87,22 @@ def test_middle_valign_still_applies_after_the_fast_path():
87
87
  # --- packaging ------------------------------------------------------------
88
88
 
89
89
  def test_py_typed_marker_ships_with_the_package():
90
- assert os.path.isfile(os.path.join(REPO_ROOT, 'flexablelib', 'py.typed'))
90
+ import flexablelib
91
+ package_dir = os.path.dirname(os.path.abspath(flexablelib.__file__))
92
+ assert os.path.isfile(os.path.join(package_dir, 'py.typed'))
93
+
94
+
95
+ def _repo_file(name):
96
+ # Downstream packagers (conda-forge) run the suite against an installed
97
+ # package with only tests/ copied over; repo-only checks skip there.
98
+ path = os.path.join(REPO_ROOT, name)
99
+ if not os.path.isfile(path):
100
+ pytest.skip(f'{name} is only present in a source checkout')
101
+ return path
91
102
 
92
103
 
93
104
  def test_manifest_ships_style_examples_and_tests_in_the_sdist():
94
- with open(os.path.join(REPO_ROOT, 'MANIFEST.in')) as handle:
105
+ with open(_repo_file('MANIFEST.in')) as handle:
95
106
  manifest = handle.read()
96
107
  assert 'include style_examples.md' in manifest
97
108
  assert 'recursive-include tests *.py' in manifest
@@ -117,7 +128,7 @@ def test_style_name_works_outside_the_repository_root(tmp_path):
117
128
 
118
129
  def test_readme_quickstart_prints_the_output_shown_below_it(capsys):
119
130
  """The first python block in README.md is what new users paste."""
120
- with open(os.path.join(REPO_ROOT, 'README.md'), encoding='utf-8') as handle:
131
+ with open(_repo_file('README.md'), encoding='utf-8') as handle:
121
132
  readme = handle.read()
122
133
  section = readme[readme.index('## 30-second quickstart'):]
123
134
  code = re.search(r'```python\n(.*?)```', section, re.S).group(1)
@@ -0,0 +1,108 @@
1
+ """2.0.18: ``border_text`` align works without ``offset=None``."""
2
+ import pytest
3
+
4
+ from flexablelib import Table
5
+ from flexablelib.text_width import strip_ansi as bare
6
+
7
+
8
+ def _framed():
9
+ table = Table(rows=[['alpha', 1], ['beta', 2], ['gamma', 3]],
10
+ headers=['name', 'n'])
11
+ table.style_name = 'modern'
12
+ return table
13
+
14
+
15
+ def _top(table):
16
+ return bare(table.compose()).splitlines()[0]
17
+
18
+
19
+ def test_default_placement_is_unchanged():
20
+ table = _framed()
21
+ table.border_text('v2', where='top')
22
+ assert _top(table) == '┌v2─────┬───┐'
23
+
24
+
25
+ def test_right_align_works_with_the_default_offset():
26
+ table = _framed()
27
+ table.border_text('v2', where='top', align='right')
28
+ assert _top(table) == '┌───────┬─v2┐'
29
+
30
+
31
+ def test_center_align_works_with_the_default_offset():
32
+ table = _framed()
33
+ table.border_text('v2', where='top', align='center')
34
+ top = _top(table)
35
+ assert top[0] == '┌' and top[-1] == '┐'
36
+ assert top.index('v2') in (5, 6)
37
+
38
+
39
+ def test_explicit_left_offset_is_the_absolute_start():
40
+ table = _framed()
41
+ table.border_text('v2', where='top', offset=4)
42
+ assert _top(table) == '┌───v2──┬───┐'
43
+ table = _framed()
44
+ table.border_text('v2', where='top', offset=0)
45
+ assert _top(table).startswith('v2─')
46
+
47
+
48
+ def test_explicit_offset_with_right_align_is_a_right_margin():
49
+ table = _framed()
50
+ table.border_text('v2', where='top', align='right', offset=3)
51
+ assert _top(table) == '┌───────v2──┐'
52
+ table = _framed()
53
+ table.border_text('v2', where='top', align='r', offset=0)
54
+ assert _top(table).endswith('─v2')
55
+
56
+
57
+ def test_explicit_offset_with_center_align_is_a_margin_on_both_sides():
58
+ table = _framed()
59
+ table.border_text('ab', where='top', align='center', offset=2)
60
+ top = _top(table)
61
+ width = len(top)
62
+ start = top.index('ab')
63
+ assert start >= 2 and start + 2 <= width - 2
64
+ assert abs((start - 2) - (width - 2 - (start + 2))) <= 1
65
+
66
+
67
+ def test_right_align_on_bottom_rule_keeps_both_corners():
68
+ table = _framed()
69
+ table.border_text('END', where='bottom', align='right')
70
+ bottom = bare(table.compose()).splitlines()[-1]
71
+ assert bottom.startswith('└') and bottom.endswith('END┘')
72
+
73
+
74
+ def test_vertical_default_skips_the_top_corner():
75
+ table = _framed()
76
+ table.border_text('AB', where='left')
77
+ lines = bare(table.compose()).splitlines()
78
+ assert lines[0][0] == '┌'
79
+ assert lines[1][0] == 'A' and lines[2][0] == 'B'
80
+
81
+
82
+ def test_vertical_right_align_ends_above_the_bottom_corner():
83
+ table = _framed()
84
+ table.border_text('XY', where='right', align='right')
85
+ lines = bare(table.compose()).splitlines()
86
+ assert lines[-1][-1] == '┘'
87
+ assert lines[-3][-1] == 'X' and lines[-2][-1] == 'Y'
88
+
89
+
90
+ def test_vertical_center_align():
91
+ table = _framed()
92
+ table.border_text('Q', where='left', align='center')
93
+ lines = bare(table.compose()).splitlines()
94
+ rows = [i for i, line in enumerate(lines) if line[0] == 'Q']
95
+ assert rows == [(len(lines) - 1) // 2]
96
+
97
+
98
+ def test_colour_still_applies_with_alignment():
99
+ table = _framed()
100
+ table.border_text('v2', where='top', align='right', color='red')
101
+ assert '\x1b[31m' in table.compose()
102
+
103
+
104
+ def test_bad_offset_is_rejected():
105
+ with pytest.raises(ValueError):
106
+ _framed().border_text('x', offset=-1)
107
+ with pytest.raises(TypeError):
108
+ _framed().border_text('x', offset='far')
@@ -1,47 +0,0 @@
1
- {
2
- "name": "flexablelib",
3
- "version": "2.0.17",
4
- "description": "Flexible console and HTML tables for Python: styles, merges, colors, widths, decimal alignment.",
5
- "main": "__init__.py",
6
- "scripts": {
7
- "test": "echo \"Error: no test specified\" && exit 1",
8
- "getversion": "npm -s run env echo '$npm_package_version'",
9
- "install-local-linux": "pip3 uninstall flexablelib -y && python3 setup.py bdist_wheel && VERSION=`npm -s run env echo '$npm_package_version'` && pip3 install dist/flexablelib-$VERSION-py3-none-any.whl",
10
- "install-local-windows": "",
11
- "release": "standard-version"
12
- },
13
- "repository": {
14
- "type": "git",
15
- "url": "git+https://github.com/Opus-Perpetuus/flexablelib.git"
16
- },
17
- "author": "Kyostenas",
18
- "license": "MIT",
19
- "bugs": {
20
- "url": "https://github.com/Opus-Perpetuus/flexablelib/issues"
21
- },
22
- "homepage": "https://github.com/Opus-Perpetuus/flexablelib#readme",
23
- "config": {
24
- "commitzen": {
25
- "path": "cz-conventional-changelog"
26
- }
27
- },
28
- "husky": {
29
- "hooks": {
30
- "commit-msg": "commitlint -E HUSKY_GIT_PARAMS",
31
- "pre-commit": "lint-staged"
32
- }
33
- },
34
- "devDependencies": {
35
- "@commitlint/cli": "^16.2.3",
36
- "@commitlint/config-conventional": "^16.2.1",
37
- "commitizen": "^4.2.4",
38
- "conventional-github-releaser": "^3.1.5",
39
- "eslint": "^8.12.0",
40
- "git-authors-cli": "^1.0.39",
41
- "husky": "^7.0.4",
42
- "lint-staged": "^12.3.7",
43
- "npm-run-all": "^4.1.5",
44
- "prettier": "^2.6.2",
45
- "standard-version": "^9.3.2"
46
- }
47
- }
File without changes
File without changes
File without changes
File without changes
File without changes