<commit_before>import pytest
import numpy as np
import astropy.units as u

from plasmapy import plasma

def test_plasma_defaults():
    test_plasma = plasma.Plasma(domain_x=np.linspace(0, 1, 64)*u.m,
                                domain_y=np.linspace(0, 1, 64)*u.m,
                                domain_z=np.linspace(0, 1, 64)*u.m)

    # Basic grid setup
    assert test_plasma.x.shape == (64,)
    assert test_plasma.y.shape == (64,)
    assert test_plasma.z.shape == (64,)
    assert test_plasma.grid.shape == (3, 64, 64, 64)

    # Core variable units and shapes
    assert test_plasma.density.shape == (64, 64, 64)
    assert test_plasma.density.si.unit == u.kg / u.m**3

    assert test_plasma.momentum.shape == (3, 64, 64, 64)
    assert test_plasma.momentum.si.unit == u.kg / (u.m**2 * u.s)

    assert test_plasma.pressure.shape == (64, 64, 64)
    assert test_plasma.pressure.si.unit == u.Pa

    assert test_plasma.magnetic_field.shape == (3, 64, 64, 64)
    assert test_plasma.magnetic_field.si.unit == u.T
<commit_msg>Parametrize test to check 1D, 2D and 3D plasma setup<commit_after>import pytest
import numpy as np
import astropy.units as u

from plasmapy import plasma

@pytest.mark.parametrize('grid_dimensions, expected_size', [
    ((100, 1, 1), 100), # Test 1D setup
    ((128, 128, 1), 16384), # 2D
    ((64, 64, 64), 262144), # 3D
])
def test_plasma_setup(grid_dimensions, expected_size):
    x, y, z = grid_dimensions
    test_plasma = plasma.Plasma(domain_x=np.linspace(0, 1, x)*u.m,
                                domain_y=np.linspace(0, 1, y)*u.m,
                                domain_z=np.linspace(0, 1, z)*u.m)

    # Basic grid setup
    assert test_plasma.x.size == x
    assert test_plasma.y.size == y
    assert test_plasma.z.size == z
    assert test_plasma.grid.size == 3 * expected_size

    # Core variable units and shapes
    assert test_plasma.density.size == expected_size
    assert test_plasma.density.si.unit == u.kg / u.m**3

    assert test_plasma.momentum.size == 3 * expected_size
    assert test_plasma.momentum.si.unit == u.kg / (u.m**2 * u.s)

    assert test_plasma.pressure.size == expected_size
    assert test_plasma.pressure.si.unit == u.Pa

    assert test_plasma.magnetic_field.size == 3 * expected_size
    assert test_plasma.magnetic_field.si.unit == u.T



{'fraction_non_alphanumeric': 0.12569952647438656, 'fraction_numerical': 0.04390873869995695, 'mean_word_length': 2.7911908646003263, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7624100', 'n_tokens_mistral': 932, 'n_tokens_neox': 826, 'n_words': 195}