返回 DeepSeek-Reasonix
test_buckets.py
1 import os
2 import sys
3 import unittest
4
5 sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
6
7 from buckets import bucket_of
8
9
10 class TestBuckets(unittest.TestCase):
11 def test_positive(self):
12 self.assertEqual(bucket_of(25, 10), 2)
13
14 def test_exact_edge(self):
15 self.assertEqual(bucket_of(30, 10), 3)
16
17 def test_negative_floors_down(self):
18 self.assertEqual(bucket_of(-1, 10), -1)
19 self.assertEqual(bucket_of(-10, 10), -1)
20 self.assertEqual(bucket_of(-11, 10), -2)
21
22
23 if __name__ == "__main__":
24 unittest.main()
25
25 lines PYTHON