PROJECT SOURCE

test_tuples.py

下载资料/01-Python/src/data_types/test_tuples.py

配套学习源码,可下载后在本机运行。

下载原文件 ↓ 下载完整学习资料 ZIP

# Selected and shortened from Oleksii Trekhleb / learn-python.
# MIT license: ../../LICENSE. Modified 2026-11-08; see download manifest.
def test_tuples():
    """Tuples"""
    fruits_tuple = ("apple", "banana", "cherry")

    assert isinstance(fruits_tuple, tuple)
    assert fruits_tuple[0] == "apple"
    assert fruits_tuple[1] == "banana"
    assert fruits_tuple[2] == "cherry"

if __name__ == "__main__":
    test_tuples()
    print("PASS")

输入关键词,查找课程与配套源码。