I was trying to build datrie with Python 3.9 (since it's beta is long out). Turns out, the tests fail with the beta. I shall paste the logs below for your reference.
I will try to look into it, and if possible submit a PR for it as well :clinking_glasses:
+ pytest-3.9
=========================================================================================================== test session starts ============================================================================================================
platform linux -- Python 3.9.0rc1, pytest-6.0.1, py-1.9.0, pluggy-0.13.1
rootdir: /home/major/rpmbuild/BUILD/datrie-0.8.2
plugins: hypothesis-5.20.3, xdist-1.34.0, cov-2.10.1, forked-1.3.0, timeout-1.4.2, mock-3.2.0
collected 38 items
tests/test_iteration.py ....... [ 18%]
tests/test_random.py ..... [ 31%]
tests/test_state.py F [ 34%]
tests/test_trie.py .................FF..FFF. [100%]
================================================================================================================= FAILURES =================================================================================================================
_____________________________________________________________________________________________________________ test_trie_state ______________________________________________________________________________________________________________
def test_trie_state():
trie = _trie()
state = datrie.State(trie)
state.walk('f')
> assert state.data() == 1
E assert 20 == 1
E + where 20 = <built-in method data of datrie.State object at 0x7f8380df4d80>()
E + where <built-in method data of datrie.State object at 0x7f8380df4d80> = data:20, term:True, leaf:False, single: False.data
tests/test_state.py:24: AssertionError
_________________________________________________________________________________________________ TestPrefixSearch.test_trie_iter_prefixes _________________________________________________________________________________________________
self = <tests.test_trie.TestPrefixSearch object at 0x7f8380ba0040>
def test_trie_iter_prefixes(self):
trie = self._trie()
trie['pr'] = 'foo'
prefixes = trie.iter_prefixes('producers')
assert list(prefixes) == ['pr', 'produce', 'producer', 'producers']
no_prefixes = trie.iter_prefixes('vasia')
assert list(no_prefixes) == []
values = trie.iter_prefix_values('producers')
> assert list(values) == ['foo', 8, 9, 1]
E AssertionError: assert [10, 10, 10, 10] == ['foo', 8, 9, 1]
E At index 0 diff: 10 != 'foo'
E Use -v to get the full diff
tests/test_trie.py:299: AssertionError
___________________________________________________________________________________________________ TestPrefixSearch.test_trie_prefixes ____________________________________________________________________________________________________
self = <tests.test_trie.TestPrefixSearch object at 0x7f8380da3d90>
def test_trie_prefixes(self):
trie = self._trie()
prefixes = trie.prefixes('producers')
assert prefixes == ['pr', 'produce', 'producer', 'producers']
values = trie.prefix_values('producers')
> assert values == [3, 8, 9, 1]
E assert [10, 10, 10, 10] == [3, 8, 9, 1]
E At index 0 diff: 10 != 3
E Use -v to get the full diff
tests/test_trie.py:320: AssertionError
_________________________________________________________________________________________________ TestPrefixSearch.test_longest_prefix_bug _________________________________________________________________________________________________
self = <tests.test_trie.TestPrefixSearch object at 0x7f8380bb2ca0>
def test_longest_prefix_bug(self):
trie = self._trie()
assert trie.longest_prefix("print") == "pr"
> assert trie.longest_prefix_value("print") == 3
E AssertionError: assert 10 == 3
E + where 10 = <built-in method longest_prefix_value of datrie.Trie object at 0x7f8380a63fc0>('print')
E + where <built-in method longest_prefix_value of datrie.Trie object at 0x7f8380a63fc0> = <datrie.Trie object at 0x7f8380a63fc0>.longest_prefix_value
tests/test_trie.py:366: AssertionError
________________________________________________________________________________________________ TestPrefixSearch.test_longest_prefix_item _________________________________________________________________________________________________
self = <tests.test_trie.TestPrefixSearch object at 0x7f8380eab730>
def test_longest_prefix_item(self):
trie = self._trie()
for index, word in enumerate(self.WORDS, 1):
> assert trie.longest_prefix_item(word) == (word, index)
E AssertionError: assert ('producers', 10) == ('producers', 1)
E At index 1 diff: 10 != 1
E Use -v to get the full diff
tests/test_trie.py:373: AssertionError
________________________________________________________________________________________________ TestPrefixSearch.test_longest_prefix_value ________________________________________________________________________________________________
self = <tests.test_trie.TestPrefixSearch object at 0x7f8380b8ff10>
def test_longest_prefix_value(self):
trie = self._trie()
for index, word in enumerate(self.WORDS, 1):
> assert trie.longest_prefix_value(word) == index
E AssertionError: assert 10 == 1
E + where 10 = <built-in method longest_prefix_value of datrie.Trie object at 0x7f8380ad7080>('producers')
E + where <built-in method longest_prefix_value of datrie.Trie object at 0x7f8380ad7080> = <datrie.Trie object at 0x7f8380ad7080>.longest_prefix_value
tests/test_trie.py:391: AssertionError
========================================================================================================= short test summary info ==========================================================================================================
FAILED tests/test_state.py::test_trie_state - assert 20 == 1
FAILED tests/test_trie.py::TestPrefixSearch::test_trie_iter_prefixes - AssertionError: assert [10, 10, 10, 10] == ['foo', 8, 9, 1]
FAILED tests/test_trie.py::TestPrefixSearch::test_trie_prefixes - assert [10, 10, 10, 10] == [3, 8, 9, 1]
FAILED tests/test_trie.py::TestPrefixSearch::test_longest_prefix_bug - AssertionError: assert 10 == 3
FAILED tests/test_trie.py::TestPrefixSearch::test_longest_prefix_item - AssertionError: assert ('producers', 10) == ('producers', 1)
FAILED tests/test_trie.py::TestPrefixSearch::test_longest_prefix_value - AssertionError: assert 10 == 1
======================================================================================================= 6 failed, 32 passed in 4.12s =======================================================================================================
Hello everyone
I was trying to build datrie with Python 3.9 (since it's beta is long out). Turns out, the tests fail with the beta. I shall paste the logs below for your reference.
I will try to look into it, and if possible submit a PR for it as well :clinking_glasses: