Closed grozin closed 1 year ago
grozin@bilbo ~/tmp/pyx-master/test/functional $ python test_text.py ignoring special 'Warning: missing glyph `Gamma'' ignoring special 'Warning: missing glyph `Gamma'' ignoring special 'Warning: missing glyph `Gamma'' ignoring special 'Warning: missing glyph `Gamma'' Traceback (most recent call last): File "/home/grozin/tmp/pyx-master/test/functional/test_text.py", line 117, in <module> ue_pfm = text.UnicodeEngine(metric=text.UnicodeEngine.pfm_metric) AttributeError: type object 'UnicodeEngine' has no attribute 'pfm_metric'
Indeed, class UnicodeEngine in pyx/text.py has only the attributes
class UnicodeEngine
pyx/text.py
>>> dir(pyx.text.UnicodeEngine) ['__class__', '__delattr__', '__dict__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__module__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', 'preamble', 'reset', 'text', 'text_pt']
I had to comment out 2 lines in test/functional/test_text.py:
test/functional/test_text.py
ue_pfm = text.UnicodeEngine(metric=text.UnicodeEngine.pfm_metric) c.insert(ue_pfm.text(10, 8, "UnicodeEngine output (PFM)"))
then tests run successfully.
Using this occasion, I'd like to add 2 points:
In pyx/text.py,
r = self._wait(self._received.wait, self._received.isSet)
isSet is deprecated, and should be replaced by is_set.
isSet
is_set
In manual/colorname.py and manual/gradientname.py,
manual/colorname.py
manual/gradientname.py
lines = imp.find_module("color", pyx.__path__)[0].readlines()
imp is deprecated, and importlib should be used instead. However, there is no exact equivalent of imp.find_module, and some thought is needed. I have not done it.
imp
importlib
imp.find_module
Indeed,
class UnicodeEngine
inpyx/text.py
has only the attributesI had to comment out 2 lines in
test/functional/test_text.py
:then tests run successfully.
Using this occasion, I'd like to add 2 points:
In
pyx/text.py
,isSet
is deprecated, and should be replaced byis_set
.In
manual/colorname.py
andmanual/gradientname.py
,imp
is deprecated, andimportlib
should be used instead. However, there is no exact equivalent ofimp.find_module
, and some thought is needed. I have not done it.