Skip to content

Commit 5216541

Browse files
committed
Flatten the package a bit for end users.
1 parent 7a9eb0d commit 5216541

File tree

4 files changed

+14
-15
lines changed

4 files changed

+14
-15
lines changed

Diff for: README.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ Here's a simple example:
3030

3131
.. code-block:: python
3232
33-
from jsonschema_lexer.lexer import JSONSchemaLexer
33+
from jsonschema_lexer import JSONSchemaLexer
3434
3535
from rich.console import Console
3636
from rich.syntax import Syntax

Diff for: jsonschema_lexer/__init__.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
11
"""
2-
Provides the JSONSchema Lexer.
2+
A JSON Schema lexer for Pygments.
33
"""
4+
5+
from jsonschema_lexer._lexer import JSONSchemaLexer
6+
7+
__all__ = ["JSONSchemaLexer"]
File renamed without changes.

Diff for: jsonschema_lexer/tests/test_integration.py

+8-13
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
"""
2-
JSON Schema Lexer tests
2+
JSON Schema Lexer tests
33
"""
44

55
from pygments.token import Token
66
import pytest
77

8-
from jsonschema_lexer.lexer import JSONSchemaLexer
9-
10-
# Test helpers.
8+
from jsonschema_lexer import JSONSchemaLexer
119

1210

1311
@pytest.fixture()
@@ -26,27 +24,24 @@ def keywords():
2624

2725

2826
def assert_single_token(lexer, s, token):
29-
"""Show that a given string generates only one token."""
27+
"""
28+
Assert a given string generates only one token.
29+
"""
3030
tokens = list(lexer.get_tokens_unprocessed(s))
3131
assert len(tokens) == 1
3232
assert s == tokens[0][2]
3333
assert token == tokens[0][1]
3434

3535

3636
def assert_tokens(lexer, string, expected_tokens):
37-
"""Show that a given string generates the expected tokens."""
37+
"""
38+
Assert a given string generates the expected tokens.
39+
"""
3840
tokens = list(lexer.get_tokens_unprocessed(string))
3941
parsed_tokens = [t[1] for t in tokens]
4042
assert parsed_tokens == expected_tokens
4143

4244

43-
# Tests
44-
45-
46-
def test_it_imports():
47-
import jsonschema_lexer # noqa: F401
48-
49-
5045
def test_data_type_tokens(lexer, data_types):
5146
for data_type in data_types:
5247
assert_single_token(lexer, data_type, Token.Name.Decorator)

0 commit comments

Comments
 (0)