Skip to content

Commit

Permalink
Remove toplevel __init__.py (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
mandel authored Aug 28, 2024
1 parent 47d9285 commit 93cc351
Show file tree
Hide file tree
Showing 25 changed files with 55 additions and 70 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ script:
- >-
echo -e "${ANSI_GREEN}Running Tests...${ANSI_RESET}"
&& echo -en 'travis_fold:start:tests\\r'
- pytest
- pytest tests
- echo -en 'travis_fold:end:tests\\r'
Empty file removed __init__.py
Empty file.
2 changes: 1 addition & 1 deletion docsource/contrib.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ To suggest a change to this repository, [submit a pull request](https://github.i

The test suite can be executed with the following command in the top-level folder:
```
pytest
pytest tests
```

Also, please make sure that your changes pass static checks such as code styles by executing the following command:
Expand Down
5 changes: 2 additions & 3 deletions tests/test_array.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from pdl.pdl.pdl_ast import Program # pyright: ignore
from pdl.pdl.pdl_interpreter import empty_scope # pyright: ignore
from pdl.pdl.pdl_interpreter import InterpreterState, process_prog # pyright: ignore
from pdl.pdl_ast import Program
from pdl.pdl_interpreter import InterpreterState, empty_scope, process_prog

array_data = {"description": "Array", "array": ["1", "2", "3", "4"]}

Expand Down
5 changes: 2 additions & 3 deletions tests/test_code.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from pdl.pdl.pdl_ast import Program # pyright: ignore
from pdl.pdl.pdl_interpreter import empty_scope # pyright: ignore
from pdl.pdl.pdl_interpreter import InterpreterState, process_prog # pyright: ignore
from pdl.pdl_ast import Program
from pdl.pdl_interpreter import InterpreterState, empty_scope, process_prog

python_data = {
"description": "Hello world showing call out to python code",
Expand Down
5 changes: 2 additions & 3 deletions tests/test_cond.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from pdl.pdl.pdl_ast import Program # pyright: ignore
from pdl.pdl.pdl_interpreter import empty_scope # pyright: ignore
from pdl.pdl.pdl_interpreter import InterpreterState, process_prog # pyright: ignore
from pdl.pdl_ast import Program
from pdl.pdl_interpreter import InterpreterState, empty_scope, process_prog

cond_data = {
"description": "Arithmetic Expressions",
Expand Down
5 changes: 2 additions & 3 deletions tests/test_defs.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from pdl.pdl.pdl_ast import Program # pyright: ignore
from pdl.pdl.pdl_interpreter import empty_scope # pyright: ignore
from pdl.pdl.pdl_interpreter import InterpreterState, process_prog # pyright: ignore
from pdl.pdl_ast import Program
from pdl.pdl_interpreter import InterpreterState, empty_scope, process_prog

defs_data = {
"description": "Hello world with variable use",
Expand Down
10 changes: 3 additions & 7 deletions tests/test_errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,9 @@

from pydantic import ValidationError

from pdl.pdl.pdl_ast import Program, empty_block_location # pyright: ignore
from pdl.pdl.pdl_interpreter import ( # pyright: ignore
InterpreterState,
empty_scope,
process_prog,
)
from pdl.pdl.pdl_schema_error_analyzer import analyze_errors # pyright: ignore
from pdl.pdl_ast import Program, empty_block_location
from pdl.pdl_interpreter import InterpreterState, empty_scope, process_prog
from pdl.pdl_schema_error_analyzer import analyze_errors


def error(raw_data, assertion):
Expand Down
2 changes: 1 addition & 1 deletion tests/test_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import pydantic
import yaml

from pdl.pdl.pdl_ast import Program # pyright: ignore
from pdl.pdl_ast import Program

EXPECTED_INVALID = [
pathlib.Path("tests") / "data" / "line" / "hello.pdl",
Expand Down
6 changes: 3 additions & 3 deletions tests/test_expr.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from pdl.pdl.pdl_ast import Program # pyright: ignore
from pdl.pdl.pdl_interpreter import empty_scope # pyright: ignore
from pdl.pdl.pdl_interpreter import ( # pyright: ignore
from pdl.pdl_ast import Program
from pdl.pdl_interpreter import (
InterpreterState,
contains_error,
empty_scope,
process_prog,
)

Expand Down
5 changes: 2 additions & 3 deletions tests/test_fallback.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from pdl.pdl.pdl_ast import Program # pyright: ignore
from pdl.pdl.pdl_interpreter import empty_scope # pyright: ignore
from pdl.pdl.pdl_interpreter import InterpreterState, process_prog # pyright: ignore
from pdl.pdl_ast import Program
from pdl.pdl_interpreter import InterpreterState, empty_scope, process_prog

direct_fallback_data = {"model": "raise an error", "fallback": "The error was caught"}

Expand Down
6 changes: 3 additions & 3 deletions tests/test_for.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from pdl.pdl.pdl_ast import Program # pyright: ignore
from pdl.pdl.pdl_interpreter import empty_scope # pyright: ignore
from pdl.pdl.pdl_interpreter import ( # pyright: ignore
from pdl.pdl_ast import Program
from pdl.pdl_interpreter import (
InterpreterState,
contains_error,
empty_scope,
process_prog,
)

Expand Down
5 changes: 2 additions & 3 deletions tests/test_function.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from pdl.pdl.pdl_ast import Program # pyright: ignore
from pdl.pdl.pdl_interpreter import empty_scope # pyright: ignore
from pdl.pdl.pdl_interpreter import InterpreterState, process_prog # pyright: ignore
from pdl.pdl_ast import Program
from pdl.pdl_interpreter import InterpreterState, empty_scope, process_prog

hello_def = {
"def": "hello",
Expand Down
13 changes: 7 additions & 6 deletions tests/test_hello.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from pdl.pdl.pdl_ast import Program # pyright: ignore
from pdl.pdl.pdl_interpreter import empty_scope # pyright: ignore
from pdl.pdl.pdl_interpreter import ( # pyright: ignore
from pdl.pdl_ast import Program, RepeatBlock
from pdl.pdl_interpreter import (
InterpreterState,
contains_error,
empty_scope,
process_prog,
)

Expand Down Expand Up @@ -121,8 +121,9 @@ def test_repeat_error():
_, _, _, trace = process_prog(state, empty_scope, data)
errors = 0
print(trace)
for document in trace.trace:
if contains_error(document):
errors += 1
if trace is not None and isinstance(trace, RepeatBlock):
for document in trace.trace:
if contains_error(document):
errors += 1

assert errors == 1
5 changes: 2 additions & 3 deletions tests/test_include.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from pdl.pdl.pdl_ast import Program # pyright: ignore
from pdl.pdl.pdl_interpreter import empty_scope # pyright: ignore
from pdl.pdl.pdl_interpreter import InterpreterState, process_prog # pyright: ignore
from pdl.pdl_ast import Program
from pdl.pdl_interpreter import InterpreterState, empty_scope, process_prog

include_data = {
"description": "Include test",
Expand Down
5 changes: 2 additions & 3 deletions tests/test_input.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from pdl.pdl.pdl_ast import Program # pyright: ignore
from pdl.pdl.pdl_interpreter import empty_scope # pyright: ignore
from pdl.pdl.pdl_interpreter import InterpreterState, process_prog # pyright: ignore
from pdl.pdl_ast import Program
from pdl.pdl_interpreter import InterpreterState, empty_scope, process_prog

input_data = {
"description": "Input block example",
Expand Down
2 changes: 1 addition & 1 deletion tests/test_line_table.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from pdl.pdl.pdl_interpreter import generate # pyright: ignore
from pdl.pdl_interpreter import generate


def do_test(t, capsys):
Expand Down
5 changes: 2 additions & 3 deletions tests/test_messages.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import yaml

from pdl.pdl.pdl_ast import Program # pyright: ignore
from pdl.pdl.pdl_interpreter import empty_scope # pyright: ignore
from pdl.pdl.pdl_interpreter import InterpreterState, process_prog # pyright: ignore
from pdl.pdl_ast import Program
from pdl.pdl_interpreter import InterpreterState, empty_scope, process_prog


def parse_prog_str(prog_str):
Expand Down
5 changes: 2 additions & 3 deletions tests/test_model.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from pdl.pdl.pdl_ast import Program # pyright: ignore
from pdl.pdl.pdl_interpreter import empty_scope # pyright: ignore
from pdl.pdl.pdl_interpreter import InterpreterState, process_prog # pyright: ignore
from pdl.pdl_ast import Program
from pdl.pdl_interpreter import InterpreterState, empty_scope, process_prog

model_data = {
"description": "Hello world with a variable to call into a model",
Expand Down
5 changes: 2 additions & 3 deletions tests/test_parse.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from pdl.pdl.pdl_ast import Program # pyright: ignore
from pdl.pdl.pdl_interpreter import empty_scope # pyright: ignore
from pdl.pdl.pdl_interpreter import InterpreterState, process_prog # pyright: ignore
from pdl.pdl_ast import Program
from pdl.pdl_interpreter import InterpreterState, empty_scope, process_prog

regex_data = {
"description": "Parsing using regex",
Expand Down
6 changes: 3 additions & 3 deletions tests/test_parser.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from pdl.pdl.pdl_ast import Program # pyright: ignore
from pdl.pdl.pdl_interpreter import empty_scope # pyright: ignore
from pdl.pdl.pdl_interpreter import ( # pyright: ignore
from pdl.pdl_ast import Program
from pdl.pdl_interpreter import (
InterpreterState,
contains_error,
empty_scope,
process_prog,
)

Expand Down
5 changes: 2 additions & 3 deletions tests/test_role.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import yaml

from pdl.pdl.pdl_ast import Program # pyright: ignore
from pdl.pdl.pdl_interpreter import empty_scope # pyright: ignore
from pdl.pdl.pdl_interpreter import InterpreterState, process_prog # pyright: ignore
from pdl.pdl_ast import Program
from pdl.pdl_interpreter import InterpreterState, empty_scope, process_prog


def parse_prog_str(prog_str):
Expand Down
2 changes: 1 addition & 1 deletion tests/test_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from pydantic.json_schema import models_json_schema

from pdl.pdl.pdl_ast import PdlBlock, PdlBlocks, Program # pyright: ignore
from pdl.pdl_ast import PdlBlock, PdlBlocks, Program


def test_saved_schema():
Expand Down
8 changes: 4 additions & 4 deletions tests/test_type_checking.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import yaml

from pdl.pdl.pdl_ast import Program # pyright: ignore
from pdl.pdl.pdl_interpreter import empty_scope # pyright: ignore
from pdl.pdl.pdl_interpreter import ( # pyright: ignore
from pdl.pdl_ast import Program
from pdl.pdl_interpreter import (
InterpreterState,
contains_error,
empty_scope,
process_prog,
)
from pdl.pdl.pdl_schema_utils import pdltype_to_jsonschema # pyright: ignore
from pdl.pdl_schema_utils import pdltype_to_jsonschema

_PDLTYPE_TO_JSONSCHEMA_TESTS = [
{
Expand Down
6 changes: 3 additions & 3 deletions tests/test_var.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from pdl.pdl.pdl_ast import Program # pyright: ignore
from pdl.pdl.pdl_interpreter import empty_scope # pyright: ignore
from pdl.pdl.pdl_interpreter import ( # pyright: ignore
from pdl.pdl_ast import Program
from pdl.pdl_interpreter import (
InterpreterState,
contains_error,
empty_scope,
process_prog,
)

Expand Down

0 comments on commit 93cc351

Please sign in to comment.