MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_helper_astuple

Method test_helper_astuple

Lib/test/test_dataclasses/__init__.py:1814–1827  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1812 self.assertTrue(d["mp"] is not c.mp) # make sure defaultdict is copied
1813
1814 def test_helper_astuple(self):
1815 # Basic tests for astuple(), it should return a new tuple.
1816 @dataclass
1817 class C:
1818 x: int
1819 y: int = 0
1820 c = C(1)
1821
1822 self.assertEqual(astuple(c), (1, 0))
1823 self.assertEqual(astuple(c), astuple(c))
1824 self.assertIsNot(astuple(c), astuple(c))
1825 c.y = 42
1826 self.assertEqual(astuple(c), (1, 42))
1827 self.assertIs(type(astuple(c)), tuple)
1828
1829 def test_helper_astuple_raises_on_classes(self):
1830 # astuple() should raise on a class object.

Callers

nothing calls this directly

Calls 5

assertEqualMethod · 0.95
assertIsNotMethod · 0.95
assertIsMethod · 0.95
astupleFunction · 0.85
CClass · 0.70

Tested by

no test coverage detected