I' dont know how to make it better it seems that I might: 
    
     assert_called_with(ANY, "foo", ANY)

but there is no code for: 

   assert_called_with(ANY, isinstance(StringIO), ANY), 

and: 

    assert_called_with(ANY, some_test , ANY),