deprecations for python 3.14 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-wcwidth?expand=0&rev=52
42 lines
1.3 KiB
Diff
42 lines
1.3 KiB
Diff
From ec2d19f90818ea608076dfbb1cb7951ac0b7372d Mon Sep 17 00:00:00 2001
|
|
From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= <miro@hroncok.cz>
|
|
Date: Wed, 28 May 2025 16:53:31 +0200
|
|
Subject: [PATCH] Don't use codecs.open on Python 3
|
|
|
|
This is to avoid:
|
|
|
|
DeprecationWarnings: codecs.open() is deprecated. Use open() instead.
|
|
---
|
|
tests/test_emojis.py | 5 +++--
|
|
1 file changed, 3 insertions(+), 2 deletions(-)
|
|
|
|
diff --git a/tests/test_emojis.py b/tests/test_emojis.py
|
|
index 4f88e23..088ee5e 100644
|
|
--- a/tests/test_emojis.py
|
|
+++ b/tests/test_emojis.py
|
|
@@ -1,6 +1,5 @@
|
|
# std imports
|
|
import os
|
|
-import codecs
|
|
|
|
# 3rd party
|
|
import pytest
|
|
@@ -11,6 +10,8 @@
|
|
except NameError:
|
|
# python 3
|
|
unichr = chr
|
|
+else:
|
|
+ from codecs import open
|
|
|
|
# some tests cannot be done on some builds of python, where the internal
|
|
# unicode structure is limited to 0x10000 for memory conservation,
|
|
@@ -146,7 +147,7 @@ def test_longer_emoji_zwj_sequence():
|
|
|
|
|
|
def read_sequences_from_file(filename):
|
|
- fp = codecs.open(os.path.join(os.path.dirname(__file__), filename), 'r', encoding='utf-8')
|
|
+ fp = open(os.path.join(os.path.dirname(__file__), filename), 'r', encoding='utf-8')
|
|
lines = [line.strip()
|
|
for line in fp.readlines()
|
|
if not line.startswith('#') and line.strip()]
|