forked from LBRYCommunity/lbry-sdk
21 lines
645 B
Python
21 lines
645 B
Python
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))
|