<commit_before>from .models import User, valid_user


def test_query_with_projection(engine):
    engine.bind(User)
    user = valid_user()
    user.profile = "Hello, World"
    engine.save(user)

    query = engine.query(
        User,
        key=User.email == user.email,
        projection={User.email, User.username})

    result = query.one()
    assert not hasattr(result, "profile")<commit_msg>Add integ test for table query with count projection #95<commit_after>from .models import User, valid_user


def test_query_with_projection(engine):
    engine.bind(User)
    user = valid_user()
    user.profile = "Hello, World"
    engine.save(user)

    query = engine.query(
        User,
        key=User.email == user.email,
        projection={User.email, User.username})

    result = query.one()
    assert not hasattr(result, "profile")


def test_scan_count(engine):
    engine.bind(User)
    for _ in range(7):
        engine.save(valid_user())
    scan = engine.scan(User, projection="count")
    assert scan.count == 0
    try:
        next(scan)
    except StopIteration:
        pass
    assert scan.count == 7
{'fraction_non_alphanumeric': 0.11446317657497782, 'fraction_numerical': 0.0044365572315882874, 'mean_word_length': 2.9166666666666665, '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': '2200493', 'n_tokens_mistral': 354, 'n_tokens_neox': 345, 'n_words': 83}