VeryApt / django-phone-field

Lightweight model and form field for phone numbers in Django
GNU General Public License v3.0
52 stars 13 forks source link

Tests fail with Django 2.1rc #1

Closed ddurdik closed 6 years ago

ddurdik commented 6 years ago
FF.....F.F........F
======================================================================
FAIL: test_admin_rendering (test_app.tests.AdminFormTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/vagrant/django-phone-field/test_proj/test_app/tests.py", line 197, in test_admin_rendering
    self.assertEqual(str(f), expected)
AssertionError: '<tr>[137 chars]ne_0">\n\n&nbsp;&nbsp;ext.&nbsp;&nbsp;<input t[68 chars]/tr>' != '<tr>[137 chars]ne_0" />\n\n&nbsp;&nbsp;ext.&nbsp;&nbsp;<input[72 chars]/tr>'

======================================================================
FAIL: test_modelform_rendering (test_app.tests.ModelFormTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/vagrant/django-phone-field/test_proj/test_app/tests.py", line 154, in test_modelform_rendering
    self.assertEqual(str(f), expected)
AssertionError: '<tr>[137 chars]ne_0">\n\n&nbsp;&nbsp;ext.&nbsp;&nbsp;<input t[68 chars]/tr>' != '<tr>[137 chars]ne_0" />\n\n&nbsp;&nbsp;ext.&nbsp;&nbsp;<input[72 chars]/tr>'

======================================================================
FAIL: test_form_rendering (test_app.tests.OptionalFormTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/vagrant/django-phone-field/test_proj/test_app/tests.py", line 134, in test_form_rendering
    self.assertEqual(str(f), expected)
AssertionError: '<tr>[128 chars]ne_0">\n\n&nbsp;&nbsp;ext.&nbsp;&nbsp;<input t[68 chars]/tr>' != '<tr>[128 chars]ne_0" />\n\n&nbsp;&nbsp;ext.&nbsp;&nbsp;<input[72 chars]/tr>'

======================================================================
FAIL: test_modelform_rendering (test_app.tests.OptionalModelFormTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/vagrant/django-phone-field/test_proj/test_app/tests.py", line 173, in test_modelform_rendering
    self.assertEqual(str(f), expected)
AssertionError: '<tr>[128 chars]ne_0">\n\n&nbsp;&nbsp;ext.&nbsp;&nbsp;<input t[68 chars]/tr>' != '<tr>[128 chars]ne_0" />\n\n&nbsp;&nbsp;ext.&nbsp;&nbsp;<input[72 chars]/tr>'

======================================================================
FAIL: test_form_rendering (test_app.tests.RequiredFormTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/vagrant/django-phone-field/test_proj/test_app/tests.py", line 109, in test_form_rendering
    self.assertEqual(str(f), expected)
AssertionError: '<tr>[137 chars]ne_0">\n\n&nbsp;&nbsp;ext.&nbsp;&nbsp;<input t[68 chars]/tr>' != '<tr>[137 chars]ne_0" />\n\n&nbsp;&nbsp;ext.&nbsp;&nbsp;<input[72 chars]/tr>'

----------------------------------------------------------------------
Ran 19 tests in 0.104s

FAILED (failures=5)

If these are spurious failures, I'm happy to contribute a PR that solves this. Let me know :)

va-andrew commented 6 years ago

That would be great, thanks!

ddurdik commented 6 years ago

Cool, will do. Should I solve this by putting in a fork for "if Django > 2.0, compare to this string instead"? Or is there something that should get generalized / loosened about the test assertion?

va-andrew commented 6 years ago

Let's go with your first suggestion, where we simply check the Django version and decide which string to match against. We can always loosen it up in the future if we find that there are frequent changes in the way Django renders widgets.