ralsina / pdfrw

Automatically exported from code.google.com/p/pdfrw
Other
0 stars 0 forks source link

Tests are failing with AttributeError #13

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Running the tests e.g. with nosetests results in a failure:

======================================================================
ERROR: test_doubleslash (tests.test_pdfstring.TestEncoding)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/valhalla/packaging/misc/pdfrw/pkg-pdfrw/tests/test_pdfstring.py", line 29, in test_doubleslash
    self.roundtrip('\\')
  File "/home/valhalla/packaging/misc/pdfrw/pkg-pdfrw/tests/test_pdfstring.py", line 26, in roundtrip
    self.assertEqual(value, self.encode_decode(value))
  File "/home/valhalla/packaging/misc/pdfrw/pkg-pdfrw/tests/test_pdfstring.py", line 23, in encode_decode
    return cls.decode(cls.encode(value))
  File "/home/valhalla/packaging/misc/pdfrw/pkg-pdfrw/tests/test_pdfstring.py", line 19, in encode
    return str(pdfrw.pdfobjects.PdfString.encode(value))
AttributeError: 'module' object has no attribute 'pdfobjects'

----------------------------------------------------------------------
Ran 1 test in 0.027s

FAILED (errors=1)

I've noticed that pdfrw/__init__.py includes a line

   from pdfrw.objects import PdfObject [...] PdfString

so I've tried to change:

  s/pdfrw.pdfobjects.PdfString/pdfrw.PdfString/g

everywhere in the file, which resulted in a passing test.

What is the expected behaviour? the one used in the tests or the one resulting 
from code?

Thanks in advance

Original issue reported on code.google.com by elena.va...@gmail.com on 30 Aug 2014 at 1:59