我是python的新手。有相当于perl的@Test
fun `get list of people`() {
// create testdata
datastore.save(Person(firstname = "test1", lastname = "lastname1"))
datastore.save(Person(firstname = "test2", lastname = "lastname2"))
datastore.save(Person(firstname = "test3", lastname = "lastname2"))
datastore.save(Person(firstname = "test4", lastname = "lastname2"))
val requestEntity = RequestEntity<Any>(HttpMethod.GET, URI.create("/person"))
// create typereference for response de-serialization
class ListOfPeople : ParameterizedTypeReference<List<Person>>() // can this be done inline in the exchange method?
val responseEntity : ResponseEntity<List<Person>> = restTemplate.exchange(requestEntity, ListOfPeople())
assertNotNull(responseEntity)
assertEquals(200, responseEntity.statusCodeValue)
assertTrue( responseEntity.body.size >= 4 )
responseEntity.body.forEach { person ->
println("Found person: [${person.firstname} ${person.lastname}] " +
", born [${person.birthdate}]")
}
}
吗?我想做的就是这个,但是在python中:
File::Find::Rule
我看过my $dir = "/users/lisa/test_directory;
# find all the files in this directory/subdirectories that contains _clean.wav
@files = File::Find::Rule -> file()
-> name("*_clean.wav")
-> maxdepth()
-> in($dir);
foreach my $file(@files) {
# do something
}
,但看不到指定某些文件名的方法。