File: test_microformat.py

package info (click to toggle)
extruct 0.18.0-1
  • links: PTS
  • area: main
  • in suites: forky, sid, trixie
  • size: 3,048 kB
  • sloc: python: 2,106; makefile: 10
file content (21 lines) | stat: -rw-r--r-- 576 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# mypy: disallow_untyped_defs=False
import json
import unittest

from extruct.microformat import MicroformatExtractor
from tests import get_testdata, jsonize_dict


class TestMicroformat(unittest.TestCase):

    maxDiff = None

    def test_microformat(self):
        body = get_testdata("misc", "microformat_test.html")
        expected = json.loads(
            get_testdata("misc", "microformat_test.json").decode("UTF-8")
        )

        opengraphe = MicroformatExtractor()
        data = opengraphe.extract(body)
        self.assertEqual(jsonize_dict(data), expected)