kopia lustrzana https://github.com/wagtail/wagtail
Fix StreamValue != operator on Python 2
rodzic
6bdbaab681
commit
5b677af33b
|
@ -361,6 +361,9 @@ class StreamValue(collections.Sequence):
|
|||
|
||||
return self.stream_data == other.stream_data
|
||||
|
||||
def __ne__(self, other):
|
||||
return not self.__eq__(other)
|
||||
|
||||
def __len__(self):
|
||||
return len(self.stream_data)
|
||||
|
||||
|
|
|
@ -2203,6 +2203,20 @@ class TestStreamBlock(SimpleTestCase):
|
|||
self.assertEqual(stream_value[0].block_type, 'heading')
|
||||
self.assertEqual(stream_value[0].value, 'A different default heading')
|
||||
|
||||
def test_stream_value_equality(self):
|
||||
block = blocks.StreamBlock([
|
||||
('text', blocks.CharBlock()),
|
||||
])
|
||||
value1 = block.to_python([{'type': 'text', 'value': 'hello'}])
|
||||
value2 = block.to_python([{'type': 'text', 'value': 'hello'}])
|
||||
value3 = block.to_python([{'type': 'text', 'value': 'goodbye'}])
|
||||
|
||||
self.assertTrue(value1 == value2)
|
||||
self.assertFalse(value1 != value2)
|
||||
|
||||
self.assertFalse(value1 == value3)
|
||||
self.assertTrue(value1 != value3)
|
||||
|
||||
|
||||
class TestPageChooserBlock(TestCase):
|
||||
fixtures = ['test.json']
|
||||
|
|
Ładowanie…
Reference in New Issue