Esempio n. 1
0
    def test_odd_input(self):
        input = iter(['test.com', 'test data',
                      'foo.org', 'foo data',
                      'bar.net'])

        result = {url: data for (url, data) in vanity.by_two(input)}

        self.assertEqual(result['test.com'], 'test data')
        self.assertEqual(result['foo.org'], 'foo data')
        self.assertIsNone(result.get('bar.net'))
Esempio n. 2
0
    def test_pairs_url_and_data(self):
        input = iter(['test.com', 'test data',
                      'foo.org', 'foo data',
                      'bar.net', 'bar data'])

        result = {url: data for (url, data) in vanity.by_two(input)}

        self.assertEqual(result['test.com'], 'test data')
        self.assertEqual(result['foo.org'], 'foo data')
        self.assertEqual(result['bar.net'], 'bar data')
Esempio n. 3
0
    def test_none(self):
        input = iter(())

        result = {url: data for (url, data) in vanity.by_two(input)}

        self.assertEqual(result, {})
Esempio n. 4
0
    def test_none(self):
        input = iter(())

        result = {url: data for (url, data) in vanity.by_two(input)}

        self.assertEqual(result, {})