test_ruleset.py 858 B

123456789101112131415161718192021222324252627
  1. #!/usr/bin/env python3
  2. # -*- coding: utf-8; -*-
  3. from __future__ import unicode_literals
  4. from unittest import TestCase
  5. import json
  6. from emojipy.ruleset import ascii_replace,\
  7. unicode_replace, shortcode_replace
  8. json_path = '../../emoji.json'
  9. class MappingTests(TestCase):
  10. def setUp(self):
  11. self.ascii_list = []
  12. with open(json_path) as json_file:
  13. content = json_file.read()
  14. self.json_dict = json.loads(content)
  15. self.emoji_count = len(self.json_dict)
  16. for key, value in self.json_dict.items():
  17. self.ascii_list.extend(value['aliases_ascii'])
  18. def test_unicode_count(self):
  19. self.assertEqual(self.emoji_count, len(unicode_replace))
  20. self.assertEqual(len(ascii_replace), len(self.ascii_list))
  21. self.assertEqual(len(shortcode_replace), len(unicode_replace))