Skip to content

Commit

Permalink
Create shared attribute object reference test (#12)
Browse files Browse the repository at this point in the history
* Create shared attribute object reference test

* Fix id test object name
  • Loading branch information
kphlips authored Aug 4, 2020
1 parent 8f322f4 commit bc10de2
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions test_particle_in_field.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,11 @@ def test_chargedparticle(sim_example):
assert isinstance(charged_example, ChargedParticle)
assert charged_example.E is None
assert charged_example.x == particle_data["position"]


def test_id_of_shared_attribute_should_not_change_after_update(sim_example):
"""Tests if a shared attribute references the same object after update"""
wave = EMWave(sim_example, wave_data)
old_id = id(wave.E)
wave.update()
assert old_id == id(wave.E)

0 comments on commit bc10de2

Please sign in to comment.