2015-11-02 00:18:26 +01:00
|
|
|
#!/usr/bin/env python3
|
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
|
|
|
|
# Copyright 2015 Mike Fährmann
|
|
|
|
#
|
|
|
|
# This program is free software; you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License version 2 as
|
|
|
|
# published by the Free Software Foundation.
|
|
|
|
|
|
|
|
import unittest
|
|
|
|
import gallery_dl.iso639_1 as iso639_1
|
|
|
|
|
|
|
|
class TestISO639_1(unittest.TestCase):
|
|
|
|
|
|
|
|
def test_code_to_language(self):
|
|
|
|
self.assertEqual(iso639_1.code_to_language("en"), "English")
|
2015-11-02 14:56:00 +01:00
|
|
|
self.assertEqual(iso639_1.code_to_language("FR"), "French")
|
2015-11-02 00:18:26 +01:00
|
|
|
self.assertEqual(iso639_1.code_to_language("xx"), "English")
|
|
|
|
self.assertEqual(iso639_1.code_to_language("xx", default=None), None)
|
|
|
|
def test_language_to_code(self):
|
|
|
|
self.assertEqual(iso639_1.language_to_code("English"), "en")
|
2015-11-02 14:56:00 +01:00
|
|
|
self.assertEqual(iso639_1.language_to_code("fRENch"), "fr")
|
2015-11-02 00:18:26 +01:00
|
|
|
self.assertEqual(iso639_1.language_to_code("Nothing"), "en")
|
|
|
|
self.assertEqual(iso639_1.language_to_code("Nothing", default=None), None)
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
unittest.main()
|