Skip to content

Commit 55225d7

Browse files
committed
ci: Include emoji and u200b in tests
1 parent 2eebc1c commit 55225d7

File tree

1 file changed

+36
-23
lines changed

1 file changed

+36
-23
lines changed

tests/test_convert.py

Lines changed: 36 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -248,37 +248,50 @@ def test_multiline_cells():
248248
assert text == expected
249249

250250

251-
def test_east_asian_wide_characters_and_zero_width():
252-
# using len() to count the number of characters
251+
def test_east_asian_wide_characters_and_zero_width_wcwidth():
252+
# using wcwidth.wcswidth() to count the number of characters
253253
text = t2a(
254-
header=["日期", "test"],
255-
body=[["2022/12/11", "test"], ["2022/1/1", "測試"]],
256-
cell_padding=5,
257-
use_wcwidth=False,
254+
header=["#\u200b", "🦁", "🦡", "🦅", "🐍"],
255+
body=[["💻", "✅", "✅", "❌", "❌"]],
256+
footer=["🥞", "日", "月", "火", "水"],
257+
first_col_heading=True,
258+
)
259+
text2 = t2a(
260+
header=["#\u200b", "🦁", "🦡", "🦅", "🐍"],
261+
body=[["💻", "✅", "✅", "❌", "❌"]],
262+
footer=["🥞", "日", "月", "火", "水"],
263+
first_col_heading=True,
264+
use_wcwidth=True,
258265
)
259266
expected = (
260-
"╔═══════════════════════════════════╗\n"
261-
"║ 日期 test ║\n"
262-
"╟───────────────────────────────────╢\n"
263-
"║ 2022/12/11 test ║\n"
264-
"║ 2022/1/1 測試 ║\n"
265-
"╚═══════════════════════════════════╝"
267+
"╔════╦═══════════════════╗\n"
268+
"║ #​ ║ 🦁 🦡 🦅 🐍 ║\n"
269+
"╟────╫───────────────────╢\n"
270+
"║ 💻 ║ ✅ ✅ ❌ ❌ ║\n"
271+
"╟────╫───────────────────╢\n"
272+
"║ 🥞 ║ 日 月 火 水 ║\n"
273+
"╚════╩═══════════════════╝"
266274
)
267275
assert text == expected
276+
assert text2 == expected
268277

269-
# using wcwidth.wcswidth() to count the number of characters
278+
279+
def test_east_asian_wide_characters_and_zero_width_no_wcwidth():
280+
# using len() to count the number of characters
270281
text = t2a(
271-
header=["日期", "test"],
272-
body=[["2022/12/11", "test"], ["2022/1/1", "測試"]],
273-
cell_padding=5,
274-
use_wcwidth=True,
282+
header=["#\u200b", "🦁", "🦡", "🦅", "🐍"],
283+
body=[["💻", "✅", "✅", "❌", "❌"]],
284+
footer=["🥞", "日", "月", "火", "水"],
285+
first_col_heading=True,
286+
use_wcwidth=False,
275287
)
276288
expected = (
277-
"╔═══════════════════════════════════╗\n"
278-
"║ 日期 test ║\n"
279-
"╟───────────────────────────────────╢\n"
280-
"║ 2022/12/11 test ║\n"
281-
"║ 2022/1/1 測試 ║\n"
282-
"╚═══════════════════════════════════╝"
289+
"╔════╦═══════════════╗\n"
290+
"║ #​ ║ 🦁 🦡 🦅 🐍 ║\n"
291+
"╟────╫───────────────╢\n"
292+
"║ 💻 ║ ✅ ✅ ❌ ❌ ║\n"
293+
"╟────╫───────────────╢\n"
294+
"║ 🥞 ║ 日 月 火 水 ║\n"
295+
"╚════╩═══════════════╝"
283296
)
284297
assert text == expected

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy