Skip to content

Fixes #1: Migrated the fn keyword to def#2

Open
kutt27 wants to merge 1 commit into
DataBooth:mainfrom
kutt27:def-migration
Open

Fixes #1: Migrated the fn keyword to def#2
kutt27 wants to merge 1 commit into
DataBooth:mainfrom
kutt27:def-migration

Conversation

@kutt27

@kutt27 kutt27 commented Jun 9, 2026

Copy link
Copy Markdown

This PR fixes #1 by migrating the fn keyword to def

I have only changed the function declaration from fn to def. All 48 tests are cleared after the change.

Also made changes to pixi.toml, replacing [project] to [workspace].

Reference:

Testing output:

$ pixi run test-all
WARN the lock file is up-to-date but uses an older format (v6), run `pixi lock` to upgrade to v7 for improved reproducibility
Pixi task (test-all): python scripts/run_tests.py
python-dotenv could not parse statement starting at line 6
python-dotenv could not parse statement starting at line 8

=== Mojo Test Suite ===

Found 11 test suites

[1/11] Basic

Running 4 tests for /home/kutt/Downloads/temp/opensource/mojo-dotenv/tests/test_basic.mojo 
    PASS [ 0.180 ] test_basic_parsing
    PASS [ 0.056 ] test_quotes
    PASS [ 0.013 ] test_comments
    PASS [ 0.018 ] test_whitespace
--------
Summary [ 0.269 ] 4 tests run: 4 passed , 0 failed , 0 skipped 


[2/11] Escapes

Running 5 tests for /home/kutt/Downloads/temp/opensource/mojo-dotenv/tests/test_escapes.mojo 
    PASS [ 0.123 ] test_escape_newline
    PASS [ 0.043 ] test_escape_tab
    PASS [ 0.037 ] test_escape_backslash
    PASS [ 0.037 ] test_escape_quote
    PASS [ 0.036 ] test_unquoted_no_escapes
--------
Summary [ 0.278 ] 5 tests run: 5 passed , 0 failed , 0 skipped 


[3/11] Export

Running 1 tests for /home/kutt/Downloads/temp/opensource/mojo-dotenv/tests/test_export.mojo 
    PASS [ 0.086 ] test_export_prefix
--------
Summary [ 0.086 ] 1 tests run: 1 passed , 0 failed , 0 skipped 


[4/11] Helpers
[dotenv] Loading from: tests/fixtures/basic.env

Running 8 tests for /home/kutt/Downloads/temp/opensource/mojo-dotenv/tests/test_helpers.mojo 
    PASS [ 0.202 ] test_backslash_counting
    PASS [ 0.082 ] test_undefined_variables_remain_literal
    PASS [ 0.274 ] test_find_dotenv_nonexistent
    PASS [ 0.081 ] test_verbose_mode
    PASS [ 0.037 ] test_keys_without_equals
    PASS [ 0.249 ] test_empty_file
    PASS [ 0.050 ] test_comments_only_file
    PASS [ 0.049 ] test_inline_comments_respect_quotes
--------
Summary [ 1.029 ] 8 tests run: 8 passed , 0 failed , 0 skipped 


[5/11] Load Dotenv

Running 1 tests for /home/kutt/Downloads/temp/opensource/mojo-dotenv/tests/test_load_dotenv.mojo 
    PASS [ 0.113 ] test_load_dotenv_basic
--------
Summary [ 0.113 ] 1 tests run: 1 passed , 0 failed , 0 skipped 


[6/11] Missing Files
Expected output: '[dotenv] File not found: tests/fixtures/missing.env'
[dotenv] File not found: tests/fixtures/missing.env
Expected output: '[dotenv] WARNING: File not found: tests/fixtures/nonexistent.env (returning empty dict)'
[dotenv] WARNING: File not found: tests/fixtures/nonexistent.env (returning empty dict)

Running 7 tests for /home/kutt/Downloads/temp/opensource/mojo-dotenv/tests/test_missing_files.mojo 
    PASS [ 0.012 ] test_load_dotenv_missing_file
    PASS [ 0.006 ] test_load_dotenv_missing_file_verbose
    PASS [ 0.006 ] test_dotenv_values_missing_file_returns_empty
    PASS [ 0.084 ] test_find_dotenv_missing_raises
    PASS [ 0.234 ] test_find_dotenv_missing_returns_empty
    PASS [ 0.005 ] test_load_dotenv_missing_does_not_affect_env
    PASS [ 0.001 ] test_load_dotenv_empty_path
--------
Summary [ 0.349 ] 7 tests run: 7 passed , 0 failed , 0 skipped 


[7/11] Multiline

Running 5 tests for /home/kutt/Downloads/temp/opensource/mojo-dotenv/tests/test_multiline.mojo 
    PASS [ 0.229 ] test_single_line_baseline
    PASS [ 0.076 ] test_multiline_double_quotes
    PASS [ 0.047 ] test_multiline_single_quotes
    PASS [ 0.043 ] test_json_multiline
    PASS [ 0.064 ] test_parsing_continues_after_multiline
--------
Summary [ 0.460 ] 5 tests run: 5 passed , 0 failed , 0 skipped 


[8/11] Override
[dotenv] Loading from: tests/fixtures/basic.env
[dotenv] Skipping existing var: KEY1
[dotenv] Skipping existing var: KEY2
[dotenv] Skipping existing var: DATABASE_URL
[dotenv] Skipping existing var: API_KEY
[dotenv] Skipping existing var: PORT
[dotenv] Skipping existing var: DEBUG
[dotenv] Loaded 0 variables

Running 4 tests for /home/kutt/Downloads/temp/opensource/mojo-dotenv/tests/test_override.mojo 
    PASS [ 0.110 ] test_override_false_preserves_existing
    PASS [ 0.042 ] test_override_true_replaces_existing
    PASS [ 0.032 ] test_new_variables_always_set
    PASS [ 0.041 ] test_verbose_mode_with_override_false
--------
Summary [ 0.227 ] 4 tests run: 4 passed , 0 failed , 0 skipped 


[9/11] Phase3Plus
[dotenv] Loading from: tests/fixtures/basic.env

Running 4 tests for /home/kutt/Downloads/temp/opensource/mojo-dotenv/tests/test_phase3plus.mojo 
    PASS [ 0.180 ] test_inline_comments
    PASS [ 0.035 ] test_keys_without_equals
    PASS [ 2.543 ] test_verbose_mode
    PASS [ 0.183 ] test_find_dotenv
--------
Summary [ 2.942 ] 4 tests run: 4 passed , 0 failed , 0 skipped 


[10/11] Python Compat

Running 5 tests for /home/kutt/Downloads/temp/opensource/mojo-dotenv/tests/test_python_compat.mojo 
    PASS [ 328.782 ] test_basic_fixture
    PASS [ 0.883 ] test_quotes_fixture
    PASS [ 0.417 ] test_comments_fixture
    PASS [ 0.522 ] test_whitespace_fixture
    PASS [ 0.624 ] test_edge_cases_fixture
--------
Summary [ 331.229 ] 5 tests run: 5 passed , 0 failed , 0 skipped 


[11/11] Variables

Running 5 tests for /home/kutt/Downloads/temp/opensource/mojo-dotenv/tests/test_variables.mojo 
    PASS [ 0.148 ] test_variable_expansion_brace_syntax
    PASS [ 0.082 ] test_variable_expansion_dollar_syntax
    PASS [ 0.066 ] test_variable_expansion_mixed
    PASS [ 0.064 ] test_variable_forward_reference
    PASS [ 0.448 ] test_undefined_variable_literal
--------
Summary [ 0.811 ] 5 tests run: 5 passed , 0 failed , 0 skipped 



==================================================
✓ All 11 test suites PASSED

All function declaration moved from fn to def and replaced pixi.toml warning
@semanticdiff-com

Copy link
Copy Markdown

Review changes with  SemanticDiff

@kutt27 kutt27 changed the title Fix: Migrated the fn keyword to def #1 Fixes #1: Migrated the fn keyword to def Jun 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Depreciation of fn keyword in mojo

1 participant