예제 #1
0
    def test_tech_diffusion(self, basic_community, advanced_community):
        params = generate_parameters(military_tech_spread_probability=1)
        advanced = advanced_community
        basic = basic_community()

        advanced.diffuse_military_tech(basic, params)
        assert basic.total_military_techs() == 1
예제 #2
0
 def test_shift_to_false(self, polity_10):
     params = generate_parameters(mutation_to_ultrasocietal=1,
                                  mutation_from_ultrasocietal=1)
     state = polity_10
     for tile in state.communities:
         tile.ultrasocietal_traits = [True]*params.n_ultrasocietal_traits
     state.cultural_shift(params)
     assert state.mean_ultrasocietal_traits() == 0
예제 #3
0
 def test_shift_to_true(self, polity_10):
     params = generate_parameters(mutation_to_ultrasocietal=1,
                                  mutation_from_ultrasocietal=1)
     state = polity_10
     state.cultural_shift(params)
     assert (
         state.mean_ultrasocietal_traits() == params.n_ultrasocietal_traits
         )
예제 #4
0
    def test_shift_to_false(self, basic_community):
        params = generate_parameters(mutation_to_ultrasocietal=1,
                                     mutation_from_ultrasocietal=1)
        tile = basic_community(params)
        tile.ultrasocietal_traits = [True] * params.n_ultrasocietal_traits

        tile.cultural_shift(params)
        assert tile.total_ultrasocietal_traits() == 0
예제 #5
0
def test_custom_parameter():
    default = default_parameters
    n_military_techs = 10
    ethnocide_max = 500
    custom = generate_parameters(n_military_techs=n_military_techs,
                                 ethnocide_max=ethnocide_max)

    assert default.n_military_techs == _default_parameters['n_military_techs']
    assert custom.n_military_techs == n_military_techs
    assert default.n_military_techs != custom.n_military_techs

    assert default.ethnocide_max == _default_parameters['ethnocide_max']
    assert custom.ethnocide_max == ethnocide_max
    assert default.ethnocide_max != custom.ethnocide_max
예제 #6
0
def test_invalid_key():
    with pytest.raises(ParameterKeyException):
        generate_parameters(bad_key='test')
예제 #7
0
def world_disintegration(generate_world):
    dimension = 5
    params = generate_parameters(disintegration_base=1000)
    return generate_world(xdim=dimension, ydim=dimension, params=params)