Beispiel #1
0
def test_numeric():
    x = IXBRL.open(TEST_ACCOUNTS[3])

    assert len(x.numeric) == 32
    for n in x.numeric:
        assert isinstance(n, ixbrlNumeric)

        if n.name == "NetCurrentAssetsLiabilities" and n.context.id == "cfwd_31_03_2017":
            assert n.format.sign == "-"
            assert n.value == -17957

        if n.format.sign == "-":
            assert n.value < 0

    assert x.numeric[0].unit == "iso4217:GBP"
    assert x.numeric[0].value == 52982
    assert x.numeric[0].name == "PropertyPlantEquipment"
    assert x.numeric[0].schema == "ns5"
Beispiel #2
0
def test_schema():
    account_schema = [
        ("https://xbrl.frc.org.uk/FRS-102/2014-09-01/FRS-102-2014-09-01.xsd",
         11),
        ("http://www.xbrl.org/uk/gaap/core/2009-09-01/uk-gaap-full-2009-09-01.xsd",
         12),
        ("http://www.xbrl.org/uk/gaap/core/2009-09-01/uk-gaap-full-2009-09-01.xsd",
         12),
        ("https://xbrl.frc.org.uk/FRS-102/2014-09-01/FRS-102-2014-09-01.xsd",
         38),
        ("https://xbrl.frc.org.uk/FRS-102/2014-09-01/FRS-102-2014-09-01.xsd",
         19),
    ]

    for k, a in enumerate(TEST_ACCOUNTS[0:5]):
        print(a)
        x = IXBRL.open(a)
        assert x.schema == account_schema[k][0]
        assert len(x.namespaces) == account_schema[k][1]
Beispiel #3
0
filenames = [
    'tests/test_accounts/account_1.html',
    "tests/test_accounts/account_2.html",
    "tests/test_accounts/account_3.html",
    "tests/test_accounts/account_4.html",
    "tests/test_accounts/account_5.html",
]

for filename in filenames:
    print(filename)
    print("=" * len(filename))
    print()

    with open(filename) as a:
        x = IXBRL(a)
        # print(x.to_table())
        print(json.dumps(x.to_table(), indent=4))
        # print(x.schema)
        # print(json.dumps(x.namespaces, indent=4))
        # print()

        # print("contexts")
        # print("--------")
        # for i in x.contexts:
        #     print(i, x.contexts[i].__dict__)
        # print()

        # print("units")
        # print("-----")
        # for i in x.units:
Beispiel #4
0
def test_open_str():
    with open(TEST_ACCOUNTS[0]) as a:
        content = a.read()
        x = IXBRL(io.StringIO(content))
        assert isinstance(x.soup, BeautifulSoup)
Beispiel #5
0
def test_units_no_prefix():
    x = IXBRL.open(TEST_ACCOUNTS[1])

    assert len(x.units) == 2
    assert x.units["currencyUnit"] == "iso4217:GBP"
    assert x.units["shares"] == "shares"
Beispiel #6
0
def test_units():
    x = IXBRL.open(TEST_ACCOUNTS[0])

    assert len(x.units) == 1
    assert x.units["GBP"] == "iso4217:GBP"
Beispiel #7
0
def test_json():
    x = IXBRL.open(TEST_ACCOUNTS[0])

    assert x.to_json()