MCPcopy Create free account
hub / github.com/TextGeneratorio/text-generator.io / test_basic_functionality

Function test_basic_functionality

test_gitbase_e2e.py:63–95  ·  view source on GitHub ↗

Test basic GitBase functionality.

()

Source from the content-addressed store, hash-verified

61
62
63def test_basic_functionality():
64 """Test basic GitBase functionality."""
65 print("=" * 60)
66 print("TESTING BASIC GITBASE FUNCTIONALITY")
67 print("=" * 60)
68
69 test_images = create_test_images()
70
71 # Test with CPU first for compatibility
72 print("\n--- Testing CPU Implementation ---")
73 captioner_cpu = GitBaseCaptioner(dtype=torch.float32, device="cpu", use_compile=False, use_channels_last=False)
74
75 for name, image in list(test_images.items())[:2]: # Test first 2 images
76 try:
77 start_time = time.time()
78 caption = captioner_cpu.caption_image(image)
79 elapsed = time.time() - start_time
80
81 print(f"Image: {name}")
82 print(f"Caption: {caption}")
83 print(f"Time: {elapsed:.3f}s")
84 print()
85
86 assert isinstance(caption, str)
87 assert len(caption) > 0
88
89 except Exception as e:
90 print(f"ERROR with {name}: {e}")
91 import traceback
92
93 traceback.print_exc()
94
95 print("✅ Basic CPU functionality test passed!")
96
97
98def test_gpu_optimizations():

Callers 1

mainFunction · 0.85

Calls 4

caption_imageMethod · 0.95
GitBaseCaptionerClass · 0.90
create_test_imagesFunction · 0.85
printFunction · 0.50

Tested by

no test coverage detected