python-mod 1.0.0

A macro library for including a Python module in Rust. At this point, very imcomplete.
Documentation
// Documentation and example tests for the python-mod crate
// These tests verify that the examples in the documentation work correctly

#[cfg(test)]
mod tests {
    #[test]
    fn test_readme_examples() {
        // Test that the examples from README.md are valid
        
        // Example: Module import syntax
        let example_code = r#"
            use python_mod::python_module;
            python_module!(py_module);
        "#;
        
        // This is a syntax validation test - if this compiles, the syntax is correct
        assert!(example_code.contains("python_module!"));
        assert!(example_code.contains("py_module"));
    }

    #[test]
    fn test_macro_syntax_variations() {
        // Test different macro syntax variations mentioned in documentation
        
        let basic_syntax = "python_module!(py_module);";
        let with_preamble = r#"python_module!{py_module
            use std::result::Result;
        };"#;
        
        assert!(basic_syntax.contains("python_module!"));
        assert!(with_preamble.contains("use std::result::Result"));
    }

    #[test]
    fn test_module_naming_conventions() {
        // Test module naming conventions
        let valid_names = vec![
            "simple_module",
            "math_ops", 
            "string_utils",
            "package_test",
        ];
        
        for name in valid_names {
            assert!(name.chars().all(|c| c.is_alphanumeric() || c == '_'));
            assert!(!name.starts_with(char::is_numeric));
        }
    }

    #[test]
    fn test_python_file_patterns() {
        // Test Python file patterns that should be supported
        let single_file_pattern = "src/module_name.py";
        let package_pattern = "src/module_name/__init__.py";
        
        assert!(single_file_pattern.ends_with(".py"));
        assert!(package_pattern.ends_with("__init__.py"));
        assert!(single_file_pattern.starts_with("src/"));
        assert!(package_pattern.starts_with("src/"));
    }

    #[test]
    fn test_macro_function_usage_patterns() {
        // Test the expected usage patterns for generated functions
        
        // Pattern: module_name::function_name()
        let usage_examples = vec![
            "py_module::run_function()",
            "math_ops::add(2, 3)",
            "string_utils::concat(\"hello\", \"world\")",
        ];
        
        for example in usage_examples {
            assert!(example.contains("::"));
            assert!(example.contains("("));
            assert!(example.contains(")"));
        }
    }

    #[test]
    fn test_expected_python_compatibility() {
        // Test that we support the expected Python features mentioned in docs
        
        let supported_features = vec![
            "function definitions",
            "return statements", 
            "basic arithmetic",
            "string operations",
            "variable assignments",
            "constants",
        ];
        
        // This is more of a documentation test
        assert_eq!(supported_features.len(), 6);
    }

    #[test]
    fn test_rython_subset_characteristics() {
        // Test understanding of Rython as a Python subset
        
        let rython_info = "Rython is generally a subset of Python";
        let limitation_note = "very limited subset of Python";
        
        assert!(rython_info.contains("subset"));
        assert!(limitation_note.contains("limited"));
    }

    #[test]
    fn test_pyro3_integration_note() {
        // Test that PyO3 integration is documented
        let integration_note = "Rython uses PyO3 to parse Python into a Rust data structure";
        
        assert!(integration_note.contains("PyO3"));
        assert!(integration_note.contains("parse"));
        assert!(integration_note.contains("Rust"));
    }
}