From 80d58383a914b7c65d1d5debe3f78a31ddca5cf7 Mon Sep 17 00:00:00 2001 From: Christian Struck Date: Mon, 28 Jan 2013 18:15:23 +0100 Subject: Added tests for the new conversion added in the last commit --- tests/test_api.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'tests') diff --git a/tests/test_api.py b/tests/test_api.py index ba2ef71..68e797b 100644 --- a/tests/test_api.py +++ b/tests/test_api.py @@ -6,6 +6,21 @@ import unittest from bvggrabber.api import QueryApi, Departure, fullformat, \ compute_remaining +from bvggrabber.utils.format import int2bin + + +class TestUtils(unittest.TestCase): + + def test_int2bin(self): + nums = [(0b1101110, 7, '1101110'), + (0b0010001, 7, '0010001'), + (0b111111, 6, '111111'), + (0b00000001, 8, '00000001'), + (0b00111, 5, '00111'), + (0b1100011, 7, '1100011')] + for b, l, s in nums: + self.assertEqual(int2bin(b, l), s) + class TestFunctions(unittest.TestCase): -- cgit v1.2.3