mirror of
https://github.com/python/cpython.git
synced 2026-04-24 21:01:04 +00:00
bpo-35578: Add an example file for testing Argument Clinic converters. (GH-11306)
This commit is contained in:
parent
95327bc80d
commit
837c7dc1ed
2 changed files with 1324 additions and 1 deletions
1307
Lib/test/clinic.test
Normal file
1307
Lib/test/clinic.test
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -44,7 +44,6 @@ def __init__(self):
|
||||||
def get(self, name, default):
|
def get(self, name, default):
|
||||||
return self.used_converters.setdefault(name, FakeConverterFactory(name))
|
return self.used_converters.setdefault(name, FakeConverterFactory(name))
|
||||||
|
|
||||||
clinic.Clinic.presets_text = ''
|
|
||||||
c = clinic.Clinic(language='C', filename = "file")
|
c = clinic.Clinic(language='C', filename = "file")
|
||||||
|
|
||||||
class FakeClinic:
|
class FakeClinic:
|
||||||
|
|
@ -798,5 +797,22 @@ def test_scaffolding(self):
|
||||||
self.assertEqual(stdout.getvalue(), 'Error in file "clown.txt" on line 69:\nThe igloos are melting!\n')
|
self.assertEqual(stdout.getvalue(), 'Error in file "clown.txt" on line 69:\nThe igloos are melting!\n')
|
||||||
|
|
||||||
|
|
||||||
|
class ClinicExternalTest(TestCase):
|
||||||
|
maxDiff = None
|
||||||
|
|
||||||
|
def test_external(self):
|
||||||
|
source = support.findfile('clinic.test')
|
||||||
|
with open(source, 'r', encoding='utf-8') as f:
|
||||||
|
original = f.read()
|
||||||
|
with support.temp_dir() as testdir:
|
||||||
|
testfile = os.path.join(testdir, 'clinic.test.c')
|
||||||
|
with open(testfile, 'w', encoding='utf-8') as f:
|
||||||
|
f.write(original)
|
||||||
|
clinic.parse_file(testfile, force=True)
|
||||||
|
with open(testfile, 'r', encoding='utf-8') as f:
|
||||||
|
result = f.read()
|
||||||
|
self.assertEqual(result, original)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
unittest.main()
|
unittest.main()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue