File: test_issue1043.py

package info (click to toggle)
rdflib 7.4.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 77,852 kB
  • sloc: python: 59,555; sh: 153; makefile: 83; ruby: 74; xml: 45
file content (24 lines) | stat: -rw-r--r-- 629 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import io
import sys

from rdflib import RDFS, XSD, Graph, Literal
from test.utils.namespace import EGDO


def test_issue_1043():
    expected = """@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .

<http://example.org/number> rdfs:label 4e-08 .


"""
    capturedOutput = io.StringIO()  # noqa: N806
    sys.stdout = capturedOutput
    g = Graph()
    g.bind("xsd", XSD)
    g.bind("rdfs", RDFS)
    g.add((EGDO.number, RDFS.label, Literal(0.00000004, datatype=XSD.decimal)))
    g.print()
    sys.stdout = sys.__stdout__
    assert capturedOutput.getvalue() == expected