In case you mean the number of live particles, rather than the total number of particles, you can get it thus:
o = bpy.context.object # Active object
ps = o.particle_systems.active # Active particle system
nLiveParticles = len([
p for p in ps.particles if p.alive_state == 'ALIVE'
For the general number of particles, you can simply print:
print( len( ps.particles ) )
This will likely be identical to the number you've specified in your particle system settings, which you can also access here:
print( ps.settings.count )
So if your object is a mesh, and you want to test whether the total particle count or live particle count equals the number of vertices, you can just assert these conditions, and get an assertion error if any of them is false:
>>> assert len( ps.particles ) == ps.settings.count, "Total number of particles equals PS settings"
>>> assert len([ p for p in ps.particles if p.alive_state == 'ALIVE' ]) == len( o.data.vertices ), "Number of live particles equals number of vertices"
Traceback (most recent call last):
File "<blender_console>", line 1, in <module>
AssertionError: Number of live particles equals number of vertices