<commit_before>import 'dart:async';
import 'package:angel_orm/angel_orm.dart';
import 'package:test/test.dart';
import 'models/car.dart';

final DateTime y2k = new DateTime.utc(2000, 1, 1);

standaloneTests(FutureOr<QueryExecutor> Function() createExecutor,
    {FutureOr<void> Function(QueryExecutor) close}) {
  close ??= (_) => null;
  test('to where', () {
    var query = new CarQuery();
    query.where
      ..familyFriendly.isTrue
      ..recalledAt.lessThanOrEqualTo(y2k, includeTime: false);
    var whereClause = query.where.compile(tableName: 'cars');
    print('Where clause: $whereClause');
    expect(whereClause,
        'cars.family_friendly = TRUE AND cars.recalled_at <= \'2000-01-01\'');
  });

  test('parseRow', () {
    var row = [0, 'Mazda', 'CX9', true, y2k, y2k, y2k];
    print(row);
    var car = new CarQuery().deserialize(row);
    print(car.toJson());
    expect(car.id, '0');
    expect(car.make, 'Mazda');
    expect(car.description, 'CX9');
    expect(car.familyFriendly, true);
    expect(y2k.toIso8601String(), startsWith(car.recalledAt.toIso8601String()));
    expect(y2k.toIso8601String(), startsWith(car.createdAt.toIso8601String()));
    expect(y2k.toIso8601String(), startsWith(car.updatedAt.toIso8601String()));
  });

  group('queries', () {
    QueryExecutor executor;

    setUp(() async {
      executor = await createExecutor();
    });
<commit_msg>Fix parseRow test<commit_after>import 'dart:async';
import 'package:angel_orm/angel_orm.dart';
import 'package:test/test.dart';
import 'models/car.dart';

final DateTime y2k = new DateTime.utc(2000, 1, 1);

standaloneTests(FutureOr<QueryExecutor> Function() createExecutor,
    {FutureOr<void> Function(QueryExecutor) close}) {
  close ??= (_) => null;
  test('to where', () {
    var query = new CarQuery();
    query.where
      ..familyFriendly.isTrue
      ..recalledAt.lessThanOrEqualTo(y2k, includeTime: false);
    var whereClause = query.where.compile(tableName: 'cars');
    print('Where clause: $whereClause');
    expect(whereClause,
        'cars.family_friendly = TRUE AND cars.recalled_at <= \'2000-01-01\'');
  });

  test('parseRow', () {
    // 'id', 'created_at',  'updated_at', 'make', 'description', 'family_friendly', 'recalled_at'
    // var row = [0, 'Mazda', 'CX9', true, y2k, y2k, y2k];
    var row = [0, y2k, y2k, 'Mazda', 'CX9', true, y2k];
    print(row);
    var car = new CarQuery().deserialize(row);
    print(car.toJson());
    expect(car.id, '0');
    expect(car.make, 'Mazda');
    expect(car.description, 'CX9');
    expect(car.familyFriendly, true);
    expect(y2k.toIso8601String(), startsWith(car.recalledAt.toIso8601String()));
    expect(y2k.toIso8601String(), startsWith(car.createdAt.toIso8601String()));
    expect(y2k.toIso8601String(), startsWith(car.updatedAt.toIso8601String()));
  });

  group('queries', () {
    QueryExecutor executor;

    setUp(() async {
      executor = await createExecutor();
    });

{'fraction_non_alphanumeric': 0.17270572299356587, 'fraction_numerical': 0.03555706061632238, 'mean_word_length': 4.191564147627417, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '7648727', 'n_tokens_mistral': 1091, 'n_tokens_neox': 1039, 'n_words': 188}