mirror of
https://github.com/DavidGailleton/42-Piscine_Python.git
synced 2026-03-14 05:06:55 +01:00
49 lines
1.3 KiB
Python
49 lines
1.3 KiB
Python
def absolute_import() -> None:
|
|
from alchemy.transmutation import lead_to_gold, stone_to_gem
|
|
|
|
print(f"lead_to_gold(): {lead_to_gold()}")
|
|
print(f"stone_to_gem(): {stone_to_gem()}")
|
|
|
|
|
|
def relative_import() -> None:
|
|
from alchemy.transmutation.advanced import (
|
|
philosophers_stone,
|
|
elixir_of_life,
|
|
)
|
|
|
|
print(f"philosophers_stone(): {philosophers_stone()}")
|
|
print(f"elixir_of_life(): {elixir_of_life()}")
|
|
|
|
|
|
def package_import() -> None:
|
|
import alchemy.transmutation
|
|
|
|
print(f"alchemy.transmutation.lead_to_gold():\
|
|
{alchemy.transmutation.lead_to_gold()}")
|
|
print(f"alchemy.transmutation.philosophers_stone():\
|
|
{alchemy.transmutation.philosophers_stone()}")
|
|
|
|
|
|
def main() -> None:
|
|
print("=== Pathway Debate Mastery ===\n")
|
|
print("Testing Absolute Imports (from basic.py):")
|
|
try:
|
|
absolute_import()
|
|
except Exception as err:
|
|
print(err)
|
|
print("\nTesting Relative Imports (from advanced.py):")
|
|
try:
|
|
relative_import()
|
|
except Exception as err:
|
|
print(err)
|
|
print("\nTesting Package Access:")
|
|
try:
|
|
package_import()
|
|
except Exception as err:
|
|
print(err)
|
|
print("\nBoth pathways work! Absolute: clear, Relative: concise")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|