Skip to content

Commit

Permalink
Merge branch 'dev-ci-github-actions'
Browse files Browse the repository at this point in the history
  • Loading branch information
astanin committed Sep 26, 2024
2 parents b76f58f + 97b67f3 commit 23e4fcd
Show file tree
Hide file tree
Showing 9 changed files with 51 additions and 16 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: lint

on:
- push
- pull_request

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.12']

steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install tox tox-gh
- name: Run linters
run: |
tox -e lint
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,15 @@ jobs:
python-version: ['3.9', '3.10', '3.11', '3.12']

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install tox tox-gh-actions
- name: Test with tox
run: tox
python -m pip install pytest numpy pandas
- name: Run tests
run: |
pytest -v --doctest-modules --ignore benchmark.py
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ pip install tabulate
Build status
------------

[![python-tabulate](https://github.com/astanin/python-tabulate/actions/workflows/github-actions-tox.yml/badge.svg)](https://github.com/astanin/python-tabulate/actions/workflows/github-actions-tox.yml) [![Build status](https://ci.appveyor.com/api/projects/status/8745yksvvol7h3d7/branch/master?svg=true)](https://ci.appveyor.com/project/astanin/python-tabulate/branch/master)
[![python-tabulate](https://github.com/astanin/python-tabulate/actions/workflows/tabulate.yml/badge.svg)](https://github.com/astanin/python-tabulate/actions/workflows/tabulate.yml) [![Build status](https://ci.appveyor.com/api/projects/status/8745yksvvol7h3d7/branch/master?svg=true)](https://ci.appveyor.com/project/astanin/python-tabulate/branch/master)

Library usage
-------------
Expand Down
4 changes: 2 additions & 2 deletions tabulate/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ def _is_file(f):


def _is_separating_line_value(value):
return type(value) == str and value.strip() == SEPARATING_LINE
return type(value) is str and value.strip() == SEPARATING_LINE


def _is_separating_line(row):
Expand Down Expand Up @@ -2770,7 +2770,7 @@ def _main():
print(usage)
sys.exit(0)
files = [sys.stdin] if not args else args
with (sys.stdout if outfile == "-" else open(outfile, "w")) as out:
with sys.stdout if outfile == "-" else open(outfile, "w") as out:
for f in files:
if f == "-":
f = sys.stdin
Expand Down
1 change: 0 additions & 1 deletion test/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
"""


import os
import sys

Expand Down
7 changes: 6 additions & 1 deletion test/test_internal.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,12 @@ def test_wrap_text_wide_chars():

rows = [["청자청자청자청자청자", "약간 감싸면 더 잘 보일 수있는 다소 긴 설명입니다"]]
widths = [5, 20]
expected = [["청자\n청자\n청자\n청자\n청자", "약간 감싸면 더 잘\n보일 수있는 다소 긴\n설명입니다"]]
expected = [
[
"청자\n청자\n청자\n청자\n청자",
"약간 감싸면 더 잘\n보일 수있는 다소 긴\n설명입니다",
]
]
result = T._wrap_text_to_colwidths(rows, widths)

assert_equal(expected, result)
Expand Down
5 changes: 4 additions & 1 deletion test/test_output.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,10 @@ def test_plain_maxcolwidth_autowraps_wide_chars():

table = [
["hdr", "fold"],
["1", "약간 감싸면 더 잘 보일 수있는 다소 긴 설명입니다 설명입니다 설명입니다 설명입니다 설명"],
[
"1",
"약간 감싸면 더 잘 보일 수있는 다소 긴 설명입니다 설명입니다 설명입니다 설명입니다 설명",
],
]
expected = "\n".join(
[
Expand Down
3 changes: 2 additions & 1 deletion test/test_textwrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,8 @@ def test_wrap_color_in_single_line():

def test_wrap_color_line_splillover():
"""TextWrapper: Wrap a line - preserve internal color tags and wrap them to
other lines when required, requires adding the colors tags to other lines as appropriate"""
other lines when required, requires adding the colors tags to other lines as appropriate
"""
# This has both a text color and a background color
data = "This is a \033[31mtest string for testing TextWrap\033[0m with colors"

Expand Down
10 changes: 5 additions & 5 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@
envlist = lint, py{38, 39, 310, 311, 312}
isolated_build = True

[gh-actions]
[gh]
python =
3.9: py39
3.10: py310
3.11: py311
3.12: py312
3.9: py39-extra
3.10: py310-extra
3.11: py311-extra
3.12: py312-extra

[testenv]
commands = pytest -v --doctest-modules --ignore benchmark.py {posargs}
Expand Down

0 comments on commit 23e4fcd

Please sign in to comment.