Skip to content

[Enhancement] 优化 Coverage 覆盖率#43

Merged
Love-Asuka merged 2 commits intoByteRainTech:devfrom
aztice:jb
Feb 3, 2026
Merged

[Enhancement] 优化 Coverage 覆盖率#43
Love-Asuka merged 2 commits intoByteRainTech:devfrom
aztice:jb

Conversation

@aztice
Copy link
Member

@aztice aztice commented Jan 31, 2026

PR For

Python

PR Types

Devs

Description

新增

def test_tensor_is_same_shape(self):
    """测试 Tensor 是否相同形状"""
    tensor1 = Tensor(dtype=DataType.FLOAT32, shape=[2, 3])
    tensor2 = Tensor(dtype=DataType.FLOAT32, shape=[2, 3])
    tensor3 = Tensor(dtype=DataType.FLOAT32, shape=[3, 2])
    self.assertTrue(tensor1.is_same_shape(tensor2))
    self.assertFalse(tensor1.is_same_shape(tensor3))

def test_tensor_properties(self):
    """测试 Tensor Properties"""
    tensor = Tensor(dtype=DataType.FLOAT32, shape=[2, 3])
    self.assertEqual(tensor.is_cuda(), tensor.device == "cuda")
    self.assertEqual(type(tensor.num_elements), str)
    self.assertEqual(type(tensor.num_bytes), str)
    self.assertEqual(type(ndim), int)
    self.assertEqual(type(shape), list[int])
    self.assertEqual(type(device), str)
    self.assertEqual(type(dtype), DataType)

删除

tensor.create()

Removed the create method from the Tensor class.
@aztice aztice requested a review from Love-Asuka January 31, 2026 06:41
@aztice aztice self-assigned this Jan 31, 2026
@paddle-bot
Copy link

paddle-bot bot commented Jan 31, 2026

Thanks for your contribution!

@codecov
Copy link

codecov bot commented Jan 31, 2026

Codecov Report

❌ Patch coverage is 46.66667% with 8 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
python/tests/core/test_tensors.py 46.66% 8 Missing ⚠️

📢 Thoughts on this report? Let us know!

@Love-Asuka
Copy link
Contributor

46.66%的差别命中率难绷

@Love-Asuka Love-Asuka merged commit a4bb554 into ByteRainTech:dev Feb 3, 2026
9 of 10 checks passed
@aztice aztice deleted the jb branch February 5, 2026 09:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants