lbry-sdk/tests/unit/db/test_result.py

22 lines
645 B
Python
Raw Normal View History

2020-06-22 01:53:18 +02:00
from unittest import TestCase
from lbry.db import Result
class TestResult(TestCase):
def test_result(self):
result = Result([], 0)
self.assertFalse(result)
self.assertEqual(0, len(result))
self.assertEqual(0, result.total)
result = Result(['a', 'b', 'c'], 100)
self.assertTrue(result)
self.assertEqual(3, len(result))
self.assertEqual(100, result.total)
self.assertEqual('b', result[1])
self.assertEqual(['a', 'b', 'c'], [o for o in result])
self.assertEqual(['a', 'b', 'c'], list(result))
self.assertEqual("['a', 'b', 'c']", repr(result))