Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

test_pipeline.py 1.3 KB

You have to be logged in to leave a comment. Sign In
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
  1. """
  2. Basic tests for the ML pipeline
  3. """
  4. import pytest
  5. import os
  6. import pandas as pd
  7. def test_data_files_exist():
  8. """Test that required data files exist"""
  9. assert os.path.exists("data/raw/iris.csv"), "Raw data file should exist"
  10. def test_data_loading():
  11. """Test that data can be loaded properly"""
  12. if os.path.exists("data/raw/iris.csv"):
  13. df = pd.read_csv("data/raw/iris.csv")
  14. assert not df.empty, "Data should not be empty"
  15. assert len(df.columns) >= 4, "Should have at least 4 feature columns"
  16. else:
  17. pytest.skip("Data file not available yet")
  18. def test_src_modules_importable():
  19. """Test that source modules can be imported"""
  20. try:
  21. import src.pipeline
  22. import src.train
  23. import src.data_preprocessing
  24. assert True
  25. except ImportError as e:
  26. pytest.fail(f"Could not import src modules: {e}")
  27. def test_requirements_satisfied():
  28. """Test that key packages are available"""
  29. try:
  30. import mlflow
  31. import sklearn
  32. import pandas
  33. import numpy
  34. assert True
  35. except ImportError as e:
  36. pytest.fail(f"Required package missing: {e}")
  37. def test_basic_math():
  38. """Simple test to ensure pytest works"""
  39. assert 1 + 1 == 2
  40. assert "hello" == "hello"
Tip!

Press p or to see the previous file or, n or to see the next file

Comments

Loading...