smaret / astrochem

A code to compute the abundances of chemical species in the interstellar medium
Other
20 stars 12 forks source link

Convert species names in Python 3 from byte litterals to simple strings #60

Closed smaret closed 4 years ago

smaret commented 8 years ago

With Python 3, test/astrochem_test gives the following error:

======================================================================
FAIL: test_read_chm (__main__.TestSequenceFunctions)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "./astrochem_test", line 93, in test_read_chm
    self.assertEqual( species, original_species )
AssertionError: Lists differ: [b'CO', b'C(+)', b'C', b'e(-)', b'OH', b'H3O(+)'] != ['CO', 'C(+)', 'C', 'e(-)', 'OH', 'H3O(+)']

First differing element 0:
b'CO'
'CO'

- [b'CO', b'C(+)', b'C', b'e(-)', b'OH', b'H3O(+)']
?  -      -        -     -        -      -

+ ['CO', 'C(+)', 'C', 'e(-)', 'OH', 'H3O(+)']

----------------------------------------------------------------------

This is because the listpecies() function returns byte literals on Python 3 and not simple strings. The function should be modified to return simple strings instead.